Pattern 30 / SCALE

Database Connection Pooling

Use this when avoiding expensive database connection setup per request.

Pressure
Avoiding expensive database connection setup per request
Mechanism
Keep a bounded pool of reusable connections and let requests borrow/return them
Toll
Too few connections queue requests; too many overload the database
Architecture plate30
Diagram for Database Connection Pooling
Executive brief

Database Connection Pooling fits when avoiding expensive database connection setup per request. Mechanism: keep a bounded pool of reusable connections and let requests borrow/return them. Use it for web apps and APIs that talk to relational databases. The toll: too few connections queue requests; too many overload the database.

Use when

Web apps and apis that talk to relational databases.

Example

Rails/puma workers sharing a controlled postgresql pool.

Review framing

Describe the pressure first, then the mechanism, then the cost. That keeps the design grounded.

Same pressure family

Scaling Patterns

26Horizontal Scaling27Vertical Scaling28Load Balancing29Auto-Scaling
โ† 2931 โ†’