I am using pgbouncer in transaction mode & trying to allow close to 500 active transaction. The purpose is simply to stress test the setup
Current setup: [ \'n\'
I know this is an old question but we had similar problem and we simply run more pgbouncers in Docker on different ports against the same database and it works OK. This way you can have different queues from different apps on separate instances of pgbouncer.
If you are running PgBouncer on the same host as PostgreSQL, you should increase CPU priority of pgbouncer
process with renice
.
renice -10 -p `pidof pgbouncer`
Default Linux scheduler is round-robin and it starves PgBouncer because it treats all processes equally - and hundreds of postgres
processes overwhelm single pgbouncer
process.
It's usually not a problem under moderate load, but it can be a really important factor when running lots of small transactions.
Even renice cannot do magic: if you run more than 10k+ TPS, you probably have to consider some load balancing (HAProxy?) in front of (multiple) PgBouncer.