← Lessons

quiz vs the machine

Gold1340

Networking

The Connection Pooling Reuse

Keeping connections alive so new requests skip setup.

5 min read · core · beat Gold to climb

Avoiding Repeated Setup

Opening a connection costs a handshake, and a secure one costs more round trips. Connection pooling keeps a set of open connections ready so later requests reuse them instead of paying that setup cost again.

How a Pool Works

A pool sits between the application and the network.

  • When a request needs a connection, the pool hands back an idle one if available.
  • If none is idle and the pool is below its limit, it opens a new connection.
  • When the request finishes, the connection returns to the pool rather than closing.

This turns the cost of setup into a one time price shared across many requests.

Sizing the Pool

A pool that is too small forces requests to wait for a free connection. A pool that is too large wastes server resources and can overwhelm the far side. The right size balances concurrency against the limits of the server and the network.

Key idea

Connection pooling reuses already open connections so requests skip handshake setup, and the pool size must balance concurrency against server and network limits.

Check yourself

Answer to earn rating on the learn ladder.

1. What cost does connection pooling mainly avoid?

2. What happens to a pooled connection after a request finishes?

3. Why can a pool that is too large be a problem?