Connection Pool Size Math

Math for pool sizing.

Overview

Connection pool size math calculates the right per-application pool size from database capacity and application instance count. The math is unforgiving: each app instance with its full pool size could in theory open that many connections, and the database has a hard limit. Default pool sizes from frameworks usually multiply out to far more than the database can handle, producing the "too many connections" failure mode that surfaces during traffic spikes when every instance opens connections simultaneously.

The approach

The practical approach is to calculate per-application pool size as (DB max_connections / app instance count) minus reserve, hold back a meaningful reserve for spikes, monitor per-pool utilization continuously so saturation surfaces before exhaustion, isolate per-tenant pools where multi-tenant workloads share a database, and document the per-pool math committed to the infrastructure repo so the calculation is reviewable.

Why this compounds

Pool math discipline compounds across services. Each correctly-sized pool prevents the next "too many connections" incident; each documented calculation survives team turnover; the team builds intuition for connection budgeting that pays off on every new service. Without the discipline, pool sizes grow ad hoc and the database hits its ceiling during the next traffic spike.

Pool math discipline is an operational discipline that pays off across years. Nova AI Ops integrates with database telemetry, surfaces pool patterns, and supports the team’s capacity engineering discipline.