Laurenz Albe wrote on 6/28/23 5:27 AM:
On Wed, 2023-06-28 at 07:19 -0400, Rita wrote:
seems like I may need to deploy pgbouncer for my webapp. should i deploy it on
the db server or on the webserver?
On the database server. You don't want network latency between pgbouncer and
PostgreSQL,
so that the connections can be active as much as possible.
That will improve throughput.
This is true, but as somebody who also deploys a fleet of stand-alone
pgBouncers in front of his dbs, a good reason to have a pgBouncer-based
traffic spigot before traffic hits your db server is that you can pause
traffic from the client to the db during maintenance, up to and
including replacing your entire db server, and all clients see is a
period of the db acting slow.
For applications that struggle with connection management, this can be
very valuable.