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.

You must already have a working PostgreSQL instance (installed, tuned, and reachable in your cluster) to which AppScan 360° can connect.
Note: These steps cover only how to put PgBouncer in front of PostgreSQL; many AppScan 360° connections are multiplexed over a small number of real PostgreSQL backends.
To add PgBouncer in front of PostgreSQL:
  1. Edit pgbouncer.ini as follows:
    [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/user
    Where:
    • max_client_conn is the ceiling AppScan 360° sees.
    • default_pool_size is what actually reaches PostgreSQL.

      Keep this value comfortably below PostgreSQL's max_connections so there is headroom for admin and other clients.

  2. 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.