How to increase the connection throughput for pgbouncer?

前端 未结 2 371
甜味超标
甜味超标 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    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.

提交回复
热议问题