Architecture

Connection pooling

Reuse a fixed pool of long-lived connections instead of opening one per request.


In plain terms

Database connections are expensive; PgBouncer, HikariCP, and the like multiplex thousands of short requests over hundreds of long connections.

Origin

Pattern as old as database connections — RPC libraries in the 1980s did similar pooling. PgBouncer (2007) and HikariCP (2013) are the modern reference implementations.

Where it shows up in production
  • PgBouncer External pooler in front of Postgres. Three modes — session, transaction, statement.
  • HikariCP JVM's standard pool. Spring Boot default since 2017.
  • pgbouncer + Lambda Pattern: many short-lived Lambdas multiplex over a small pool. Solves connection-storm pathology.
Sources & further reading
Found this useful?