Postgresql – pgBouncer does not use all available CPUs

pgbouncerpostgresql

I have a server with multiple cores that is supposed to run pgBouncer (1.7).

It's working pretty well, but it utilises only one CPU core. I get pretty high latency values when I do a load test with pgbench, emulating several clients (27 ms without pgBouncer, and 62 ms with pgBouncer).

How can I make pgBouncer use all available CPU cores?

Best Answer

Pgbouncer implementation is based on epoll system call and runs one thread only. You pretty much have to run several pgbouncer processes to utilize more cores(one process per core). But it is what you want to do only when pgbouncer is a bottleneck.