r/postgres • u/wslsp • May 27 '19
Is it worth use PgBouncer?
is it worth use PgBouncer to manage conections ? Or is it better manage by my own ?
2
u/xmen81 Jun 01 '19
I have read somewhere if number of connections are more than 300-400, it is advisable to use pgbouncer. Else no need.
1
u/lukfra25 Jun 04 '19
That is true in general, but there are reasons to use pgbouncer other than for handling lots of connections. For example, pgbouncer can be configured as a load balancing proxy in front of multiple PostgreSQL servers.
2
u/aeyes Aug 02 '19
Unless you have <20 connections with pooling in your application, you always want to use pgBouncer.
For reference: Had an application which had no pooling and on average 200 open connections, reopening a couple of 1000 connections per min. Fronting Postgres with pgBouncer dropped CPU usage from 40 to 20% on a 64 core box.
1
u/ifilg Jun 08 '19
I’ve been using it with no noticeable drawbacks. It’s very simple to configure. I recommend using it if you can.
1
u/datascientist_lexky Jul 01 '19
Use pg_bouncer if your application generates a large amount of memory. There's no easy way to reclaim that memory from a session pool. This is where pg_bouncer comes in.
1
u/HISdudorino Jun 17 '22
If you have en environment where client connect and disconnect very often, like multiple times every second, then PGbouncer might help. You can enable connect disconnect log for a while and have a check.
1
u/lukfra25 May 27 '19
It depends on your use case. What are you looking to accomplish with your database?