practice

Little's Law Applied to Pools

Using L = λW to size connection and thread pools from measured throughput and latency rather than from a default.

capacitypoolssizing

Pool sizes are usually inherited from a framework default and then adjusted by superstition. Little's Law makes it arithmetic.

Concurrency = throughput × latency. At 500 requests per second with 20 ms spent in the database per request, average in-flight database work is 500 × 0.02 = 10 connections. A pool of 10 is the average requirement; you size above it for variance and for the tail, not by an order of magnitude.

Two checks that follow immediately. Total connections = pool size × instance count, which must stay below the server's limit — this is the arithmetic that catches the classic outage where an autoscaler doubles instances and the database refuses connections. And pool size caps throughput: at 20 ms latency, a pool of 10 can serve at most 500 requests per second no matter what else you fix.

The counter-intuitive result: making a pool larger frequently makes things slower, because the bottleneck moves to the database, where more concurrent work means more contention. The correct pool is usually smaller than instinct suggests.