Practical System Design. Tail Latency

pool.acquire

  1. payload = build_payload(request)
  2. with pool.acquire() as conn:
  3. result = query_database(conn, payload)
  4. query_ms = 70
  5. lookups_per_sec =
  1. Query70 ms, and it stays there
  2. Acquire p958 ms. The bar is 50 ms.
  3. Lookups560 a second into a pool of 40

Acquire time

Each bar is a recent wait for a connection. Query time stays at 70 ms.

n=0

Acquire samples collect once the run starts. The query mark stays at 70 ms.

Query 70 ms. Acquire p95 8 ms. The pass bar is 50 ms.

Live metrics

ReadyThe query hold stays at 70 ms. Acquire p95 rises and falls with the offered lookup rate.
Metric definitions
MetricValueWhat it means
Query70 msTime a connection is held. This stays at 70 ms.
Acquire p958 msWait for a connection. Hold this under 50 ms.
Lookups560/sOffered to the 40-connection pool. 400/s passes. 560/s does not.
Demand39Lookups per second times 70 ms, in connections. The pool holds 40.
70 ms
8 ms
560/s
39