0

I was able to setup two pgbouncer instances for database connection pooling, on a single VM (CentOS 7.0) listening to same port (6432) on two different TCP socket (I believe) using Linux Kernel feature SO_REUSEPORT. From the documentations the kernel is supposed to load-balance between two socket and send the connection to one of socket at a time however in my case in the pgbouncer logs(separate files) I have seen both instances receives the same connection.

I have seen that the TCP connection distribution works based on some hashing which take ip/port combination for routing. Do I need to differentiate incoming connections somehow to achieve the expected behaviour of routing to single socket? For testing I am using a psql client from another VM.

UPDATE

Even though both receives connection with login attempt to pgbouncer only one of them establishing connection with Database. Is this normal behaviour?

3
  • 1
    Both listener socket will be notified that a new connection is available but only one accept will succeed in getting it, because there is only one connection. I don't see anything in the documentation which says otherwise. It's not that much different from sharing a single listener socket between multiple processes, only that there are multiple separate listener queues vs. one shared listener queue. Commented Jan 25 at 4:40
  • So you saying the setup working normal? As long as the DB get connection from only one instance it's fine which is I verified and seems okay.
    – goodfella
    Commented Jan 25 at 6:15
  • It works as I would expect it to work. Commented Jan 25 at 7:06

0

You must log in to answer this question.

Browse other questions tagged .