Adding PgBouncer in front of PostgreSQL for AppScan 360°
After installation, you may observe database-related exceptions. Adding PgBouncer in front of PostgrSQL addresses this.
Under load, an application that opens many short-lived connections can exhaust PostgreSQL
and then PostgreSQL returns the error FATAL: sorry, too many clients
already. PgBouncer sits between AppScan 360° and PostgreSQL,
accepts a large number of client connections, and serves them from a small pool of
reused backend connections.
AppScan 360° ──(many client connections)──> PgBouncer ──(small
pool)──> PostgreSQL
PostgreSQL opens one backend process per connection; therefore
max_connections has to stay modest.
- Edit
pgbouncer.inias follows:
Where:[databases] ; One entry per database AS360 uses. Point at your existing PostgreSQL host/port. asoc_db = host=<POSTGRES_HOST> port=5432 dbname=AppScan360Database [pgbouncer] listen_addr = 0.0.0.0 listen_port = 6432 pool_mode = transaction max_client_conn = 1000 ; how many AS360-side connections PgBouncer accepts default_pool_size = 25 ; real PostgreSQL connections per database/usermax_client_connis the ceiling AppScan 360° sees.default_pool_sizeis what actually reaches PostgreSQL.Keep this value comfortably below PostgreSQL's
max_connectionsso there is headroom for admin and other clients.
- Point AppScan 360° at PgBouncer.
Change the AppScan 360° database connection from the PostgreSQL host/port to PgBouncer:
Setting Value Host <PGBOUNCER_HOST> Port 6432 Database <360_db> You might need to add authentication. See PgBouncer documentation for more information on adding authentication.