Skip to content
StackDecode
System Design
16. Performance EngineeringAnimated

Connection Pool Optimisation

Sizing and tuning pools.

The idea

Right-sized pools keep databases busy without overloading them.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

App thread 1App thread 2App thread 3Connection poolDatabase
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Opening a database connection is slow.

step:
1/4
at:
Connection pool
1/11

The green dot is a request moving through the system.

Step by step

  1. 1Measure concurrent queries
  2. 2Set min and max sizes
  3. 3Add timeouts and validation
  4. 4Monitor wait time

Where it is used

Database access.

Watch out for

Too large a pool hurts the database.

Related