-
Hello here 👋 I am implementing a production stack where I have pgbouncer as a connections poolers in front of a AWS RDS postgres database, hosted in RDS AWS. Nonetheless, I noticed that in the beginning of my research that my pool size was too low which was creating a huge bottleneck for my apps. So I increased it dramatically (but maybe too much?). here are my different configurations: db sizing :
# pgbouncer.ini
[databases]
db = host=my-host dbname=mydb port=5432 pool_size=550
[pgbouncer]
pool_mode = transaction
listen_port = 6543
listen_addr = *
auth_type = md5
auth_file = /etc/pgbouncer/users.txt
stats_users = user
ignore_startup_parameters = extra_float_digits
max_client_conn = 500
verbose = 0
log_disconnections = 0
log_connections = 0
server_tls_sslmode = prefer
server_tls_ciphers = normal Basically, I just changed the following paramets:
The CPU performance insight seems to be ok, but I have a huge numbers of sessions (cannot post any screenshot at the moment due to a GitHub bug apparently):
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
I think one problem is that with The exact configuration of course depends very much on local specifics, but consider something like The discussion about number of CPUs versus number of sessions is for PostgreSQL proper but does not apply to PgBouncer in the same way. PgBouncer can run thousands of connections on a single CPU. |
Beta Was this translation helpful? Give feedback.
I think one problem is that with
max_client_conn
500 andpool_size
550 you are defeating one of the purposes of PgBouncer a bit. That purpose is roughly speaking to allow more connections from client->pgbouncer and convert those to fewer connections pgbouncer->server. However, in your configuration, you are at best passing all connections through and not gaining anything.The exact configuration of course depends very much on local specifics, but consider something like
max_client_conn
1000 andpool_size
100 to get a real effect out of pgbouncer.The discussion about number of CPUs versus number of sessions is for PostgreSQL proper but does not apply to PgBouncer in the same way. PgBounce…