How to increase the connection throughput for pgbouncer?

前端 未结 2 372
甜味超标
甜味超标 2021-01-11 09:58

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\'

相关标签:
2条回答
  • 2021-01-11 10:10

    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.

    0 讨论(0)
  • 2021-01-11 10:20

    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.

    0 讨论(0)
提交回复
热议问题