KK CHN wrote:
> default_pool_size = 40
That limits the number of connections from pgBouncer to the database
to 40. That's per user/database, but pgbench connects to the same
database/same user. So when running pgbench -c 200, without pgBouncer
there are 200 active connections, whereas through pgBouncer there are
only 40 active connections in Postgres.
When queries are issued to pgBouncer and the 40 connections
are already busy, it makes them wait.
That alone might explain why the average latencies are so different
between pgBouncer and direct connections.
If you really want to support 200 concurrent clients, increase the pool
size accordingly.
Best regards,
--
Daniel Vérité
https://postgresql.verite.pro/