Practical System Design. Traffic Surge

pool.acquire

  1. payload = build_payload(request)
  2. with pool.acquire() as conn:
  3. result = query_database(conn, payload)
  4. admit_per_sec =
  1. Stage300 lookups a second
  2. Acquire p952 ms. The bar is 50 ms.
  3. Rejected0.0 percent. The bar is under 1 percent.

Load-test stages

300 and 400 lookups a second pass both bars. 480 rejects about 2 percent while acquire p95 is still 25 ms. 560 rejects 120 of 560.

now 300/s · limit 560/s

50 ms300/s2 ms400/s8 ms480/s25 ms560/s80 ms
This stage rejects 0.0 percent. Acquire p95 is 2 ms. A pass needs both numbers inside the bars, on the last stage that clears them.

Live metrics

Ready300 a second passes. 400 a second passes. 480 a second does not.
Metric definitions
MetricValueWhat it means
Stage300/sThe load-test row running now. The ladder is 300, 400, 480, 560.
Acquire p952 msHold this under 50 ms. At 480 it can still be 25 ms.
Rejections0.0%Must stay under 1 percent. 480 fails this bar even when p95 looks fine.
Limit560/sThe highest stage the test is allowed to reach. The last passing stage is 400/s.
300/s
2 ms
0.0%
560/s