pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Moreno Andreo <moreno.andreo@evolu-s.it>
To: pgsql-general@lists.postgresql.org
Subject: Re: Connection pooling for differing databases?
Date: Thu, 7 Mar 2019 20:39:34 +0100
Message-ID: <877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it> (raw)
In-Reply-To: <CANrrCRzh-mJx4nmsn4Av5dH7S=9ONoQY=rzn8CnkNp_mOEBSNg@mail.gmail.com>
References: <CANrrCRzh-mJx4nmsn4Av5dH7S=9ONoQY=rzn8CnkNp_mOEBSNg@mail.gmail.com>

Il 07/03/2019 20:27, Arjun Ranade ha scritto:
> Hi all,
>
> I'm wondering if there's a tool like pgpool that can provide a single 
> origin point (host/port) that will proxy/direct connections to the 
> specific servers that contain the db needing to be accessed.
Yes, I think there are many, but I'm encouraging you to take a look at 
pgbouncer

https://pgbouncer.github.io/

in pgbouncer.ini you enter database configuration values like

database = host=hostname port=xyzk, like
mydb1 = host=cluster1 port=6543 or
mydb2 = host=cluster1 port=9876
mydb3 = host=cluster2 port=6543

but there many other parameters to refine your config (like "proxying" 
database names, so if you share names across clusters you can easily 
avoid conflicts)

Pgbouncer should be installed on the same server as the databases or in 
another and listens on a different port than Postgres' (say 5431 while 
postgres is on 5432)
I'm actively using in my environment with 2 clusters and about 500 
databases, works flawlessly.

One thing you have to consider, if under heavy workload (say 100's of 
connections) is to raise kernel value of maximum open files

Cheers

Moreno.-






view thread (6+ messages)  latest in thread

Message-ID: <877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it>
Permalink:  ../877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it/
Also on:    postgresql.org/message-id/877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: moreno.andreo@evolu-s.it
  Subject: Re: Connection pooling for differing databases?
  In-Reply-To: <877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it>
  References: <CANrrCRzh-mJx4nmsn4Av5dH7S=9ONoQY=rzn8CnkNp_mOEBSNg@mail.gmail.com> <877c818f-1902-ebb7-e882-c7689627a08b@evolu-s.it>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox