I have such a setup:

  • OpenSUSE 13.1 64-bit
  • Linux kernel 3.11.10
  • PostgreSQL 9.0 + PgBouncer 1.5.4 (libevent-2.0)
  • 16 core AMD, 128 GB RAM

PostgreSQL config:

  • max_connections = 1500
  • shared_buffers = 4GB
  • work_mem = 20MB

PgBouncer config:

  • max_client_conn = 15000
  • default_pool_size = 275

I try to saturate the server using pgbouncer.

I was running a Select-only test, with 1000 clients for 5 minutes. (pgbench -p 6433 -n -S -c 1000 -T 300). PgBouncer was initializet with scale=100 (but a SELECT-only test should not suffer on it).

During the test:

  • pgbench takes 70% of one CPU core and pgbouncer takes 30% of another core. Total core usage is 8-10%
  • SHOW POOLS tells that cl_active is only about 50, and all the rest is cl_waiting.
  • number of non-idle server queries (according to pg_stat_activity) is very low (2-3).
  • server load is only about 2.5

So it looks like pgbouncer cannot spawn enough parallel server sessions?

I'm not sure how that can happen while it looks that no basic resources are saturated. (CPU, mem, # of connections)

I also tried with 5000 connections (using 10 parallel pgbenches) - same effect. Only about 50 cl_active.

When I run pgbench connecting directly to postgres (port 5432) - it spawns hundreds of sessions without problem.

I'd be grateful for any hints. Can this be pgbouncer, postgres or kernel parameters issue?



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.