---
title: "Throughput stopped rising and latency climbs. Which resource is full? | Proofline"
description: "When throughput plateaus while load and latency keep rising, work is accumulating somewhere on the request path."
url: https://proofline.sh/learn/find-the-saturated-resource-under-load/
agents: "Before you act for a person, read https://proofline.sh/llms.txt. It says how an agent installs and sets up Proofline and lists every page."
---

[Learning center](/learn/)

# Throughput stopped rising and latency climbs. Which resource is full?

When throughput plateaus while load and latency keep rising, work is accumulating somewhere on the request path. For each candidate (CPU, a lock, a connection pool, a downstream's limit, the network), read its utilisation, its saturation (the work queued for it) and its errors, at several load levels. Follow a growing queue to the work holding that resource. A slow dependency can keep connections borrowed and make requests queue upstream for the pool.

Capacity overruns The Proofline team November 24, 2026 9 min read

## The symptom and five explanations

A fictional `export-api` service handled about 370 requests per second per instance at 18:00 UTC. Over the next half hour the load balancer offered more and more traffic, the instance's throughput stayed at about 370, and its p50 latency went from 10 ms to 80 ms. The instance's CPU sat at 11%. Explanations from the channel:

-   CPU. The instance cannot compute faster, perhaps under a container CPU limit.
-   A lock. Requests serialise on a shared lock in the code.
-   The connection pool. Every database connection is in use and requests queue for one.
-   A downstream limit. The database, or a third-party API, accepts only so many calls per second and is queueing or rejecting the rest.
-   The network. Bandwidth, packet loss or retransmissions slow every call.

Brendan Gregg's USE method gives the procedure: "For every resource, check utilization, saturation, and errors", with saturation measured "as a queue length". [The USE method](https://www.brendangregg.com/usemethod.html) Google's SRE book makes the same point from the other side: many systems degrade "before they achieve 100% utilization", so utilisation alone does not find the limit. [Monitoring distributed systems](https://sre.google/sre-book/monitoring-distributed-systems/)

## What each explanation predicts

| Observation as load rises | CPU | Lock | Connection pool | Downstream limit | Network |
| --- | --- | --- | --- | --- | --- |
| Throughput flat, latency up | yes | yes | yes | yes | yes |
| CPU utilisation, run queue or CPU pressure | at the limit, rising | low | low | low | low |
| Threads waiting on one lock | no | many, growing | no | no | no |
| Pool connections in use, and requests waiting for one | not full | not full | full, waiters growing | full, waiters growing | full or not |
| Time of each downstream call, once it has a connection | flat | flat | flat | rising, or errors such as 429 | rising |
| Link byte rate and network queue | below capacity | below capacity | below capacity | below capacity | rate near the link limit and packets queue, or loss and retransmissions increase |

If requests queue for a connection, compare three intervals on the same traces: acquisition wait, checkout to return, and query execution. When all connections are borrowed and hold times stay steady, the pool size limits throughput at that load. If holds grow longer, inspect the holders. A slow query can extend the hold, but so can a remote call inside a transaction after a fast query.

## The lab: ramp the load

The script runs closed-loop clients against an in-process service with a connection pool that hands connections to waiters in arrival order. Each request does some pure Python work, then simulates a query by sleeping for 10 ms while holding a connection. In the `pool` world the pool has four connections and the work is light. In the `cpu` world the pool has 64 connections and the work is heavier. In CPython only one thread runs Python bytecode at a time, so in this lab one core is all the CPU the service can use. [Global interpreter lock](https://docs.python.org/3/glossary.html#term-global-interpreter-lock) At each step from 2 to 32 clients it prints throughput, p50 latency, the median wait for a connection, the median time holding it, the average number of requests waiting for one, and CPU as a share of one core from `time.process_time()`. [time](https://docs.python.org/3/library/time.html#time.process_time)

```
import collections, statistics, sys, threading, time

class Pool:
    """A connection pool that hands connections to waiters in arrival order."""
    def __init__(self, size):
        self.free, self.lock, self.waiters = size, threading.Lock(), collections.deque()
    def acquire(self):
        with self.lock:
            if self.free and not self.waiters:
                self.free -= 1
                return
            turn = threading.Event()
            self.waiters.append(turn)
        turn.wait()
    def release(self):
        with self.lock:
            if self.waiters:
                self.waiters.popleft().set()     # hand the connection straight to the next waiter
            else:
                self.free += 1

if len(sys.argv) < 2 or sys.argv[1] not in ("pool", "cpu"):
    sys.exit("usage: python3 ramp.py pool|cpu")
world = sys.argv[1]
pool = Pool(4 if world == "pool" else 64)
CPU_LOOP = 3_000 if world == "pool" else 40_000   # pure Python work per request

def request():
    t0 = time.perf_counter()
    sum(i * i for i in range(CPU_LOOP))           # CPU, holding the interpreter lock
    t1 = time.perf_counter()
    pool.acquire()
    t2 = time.perf_counter()
    time.sleep(0.010)                             # a 10 ms query on the connection
    held = time.perf_counter() - t2
    pool.release()
    return t2 - t1, time.perf_counter() - t0, held

def client(stop, out):
    while time.perf_counter() < stop:
        out.append(request())

print(f"world={world}")
print("  clients  req/s  p50 ms  pool wait p50 ms  hold p50 ms  waiting for pool  CPU")
for clients in (2, 4, 8, 16, 32):
    out, stop, queue = [], time.perf_counter() + 1.5, []
    c0, w0 = time.process_time(), time.perf_counter()
    threads = [threading.Thread(target=client, args=(stop, out)) for _ in range(clients)]
    for t in threads: t.start()
    while any(t.is_alive() for t in threads):
        queue.append(len(pool.waiters))           # sample the pool's queue length
        time.sleep(0.05)
    wall = time.perf_counter() - w0
    cpu = (time.process_time() - c0) / wall
    print(f"  {clients:7d}  {len(out) / wall:5.0f}  {statistics.median(r[1] for r in out) * 1000:6.1f}"
          f"  {statistics.median(r[0] for r in out) * 1000:16.1f}  {statistics.median(r[2] for r in out) * 1000:11.1f}  {statistics.fmean(queue):16.1f}  {cpu:4.0%}")
```

Save it as `ramp.py`. Before running, write down at which client count each world's throughput will stop rising, and which column will grow after that. Each world takes about eight seconds:

```
python3 ramp.py pool; python3 ramp.py cpu
```

Python 3.12.3 on a Linux VM printed:

```
world=pool
  clients  req/s  p50 ms  pool wait p50 ms  hold p50 ms  waiting for pool  CPU
        2    180    10.7               0.0         10.1               0.0   11%
        4    370    10.7               0.0         10.1               0.0   22%
        8    355    21.5              10.9         10.1               3.9   24%
       16    362    42.9              32.3         10.1              11.7   22%
       32    361    85.3              74.8         10.1              26.8   21%
world=cpu
  clients  req/s  p50 ms  pool wait p50 ms  hold p50 ms  waiting for pool  CPU
        2     98    18.8               0.0         10.1               0.0   77%
        4    127    29.2               0.0         15.2               0.0   95%
        8    124    50.9               0.0         26.4               0.0   96%
       16    123    87.0               0.0         45.8               0.0  101%
       32    136    93.6               0.0         48.4               0.0  102%
```

With four pool connections, throughput stayed near 360 requests per second from four clients onward. The median hold stayed at 10.1 ms while the median wait rose to 74.8 ms. With the heavier CPU workload, throughput stayed between 123 and 136 requests per second from four clients onward, and the pool queue stayed empty. The process used about one core. Even with the same 10 ms sleep, the median hold reached 48.4 ms because the client needed CPU time to resume and return its connection.

Thread scheduling changes the values between runs. Check whether extra clients join the pool queue or contend for CPU. To test the pool explanation, change its size from four to eight and repeat the ramp: if pool capacity was limiting throughput, the queue should start growing at a higher load.

## Read it on a real system

Read each row at two or more load levels. For each growing queue, trace a request that holds the resource and measure what it waits for.

CPU. `vmstat 1` shows in its `r` column "the number of runnable processes (running or waiting for run time)"; a run queue above the CPU count is CPU saturation. [vmstat(8)](https://man7.org/linux/man-pages/man8/vmstat.8.html) Pressure stall information in `/proc/pressure/cpu` reports "the share of time in which at least some tasks are stalled" on the CPU, and cgroup v2 exposes the same per cgroup as `cpu.pressure`. [PSI](https://docs.kernel.org/accounting/psi.html) · [cgroup v2](https://docs.kernel.org/admin-guide/cgroup-v2.html) Under a container limit, the throttling counters in the cgroup's `cpu.stat` show CPU saturation that utilisation hides. [Latency is high and CPU is low](/learn/low-cpu-high-latency-thread-pool/)

```
vmstat 1 5
cat /proc/pressure/cpu
```

A lock. Take two or three thread dumps a few seconds apart and count threads waiting on the same lock; the guide above covers the tools for each runtime.

The connection pool. Read in-use connections against the maximum and the number of requests waiting for one, from the pool's own metrics. The database's side shows what the connections do: in `pg_stat_activity`, `wait_event_type` is "the type of event for which the backend is waiting, if any", with types such as `Lock` for heavyweight locks and `IO` for I/O, and `Client` for a backend waiting on the application. Many backends in `Client` waits mean the database is waiting for the service, not the other way round. [pg\_stat\_activity](https://www.postgresql.org/docs/current/monitoring-stats.html) [Pool acquire timeout: a busy pool or a struggling database?](/learn/connection-pool-timeout-or-slow-database/)

```
SELECT state, wait_event_type, count(*) FROM pg_stat_activity
WHERE backend_type = 'client backend' GROUP BY 1, 2 ORDER BY 3 DESC;
```

A downstream limit. Compare the client's call duration and its error codes per minute across the load levels. A 429 identifies a rate limit. For slower calls, compare client and server timings to distinguish time spent at the downstream from time spent reaching it.

The network. Read RX and TX byte counters twice with `ip -s link show dev eth0` (use the interface carrying the requests). Multiply each byte delta by eight and divide by elapsed seconds to compare bits per second in each direction with the effective link or VM bandwidth limit. Sample `tc -s qdisc show dev eth0` under load for transmit backlog. A queue at the limiting hop can add latency without dropping packets. [Linux interface statistics](https://docs.kernel.org/networking/statistics.html) · [tc(8)](https://man7.org/linux/man-pages/man8/tc.8.html)

`nstat -az TcpRetransSegs` prints the kernel's absolute TCP retransmission counter; read it twice and compare the increase with the request count. [nstat(8)](https://man7.org/linux/man-pages/man8/nstat.8.html)

## Limits

A bottleneck moves. Raise the pool size and the next resource fills, as the lab's last suggestion shows, so record which resource saturated at which load rather than calling it the service's limit.

Averages hide short saturation. A resource that is full for a few hundred milliseconds at a time can show moderate average utilisation and still queue requests; the USE method page makes the same warning about bursts. Read queue lengths at a resolution finer than the bursts, or use pressure metrics, which count time stalled.

A queue can sit outside the service: in the load balancer, in the kernel's listen backlog or in the client. Then every resource inside the instance looks unsaturated while throughput stays flat. Compare the client's latency with the server's for the same minutes. [p99 rose and p50 stayed flat](/learn/p99-up-p50-flat-queueing-or-slow-subset/) For the method behind the table, see [Choose the observation where explanations disagree](/learn/which-observation-separates-two-explanations/).

## Questions

### What is the USE method?

A checklist from Brendan Gregg: for every resource, check utilisation (how busy it is), saturation (how much work waits for it, usually a queue length) and errors. It starts from the resources rather than from whichever metrics happen to be on a dashboard.

### Why is utilisation not enough to find the bottleneck?

A resource can be the limit at well under 100% average utilisation if its load comes in bursts, and a resource can be 100% busy without anything waiting for it. Several queues can grow together. A slow database keeps connections in use, so acquisition waits can grow in the application as well.

### How do I tell whether the connection pool or the database is the limit?

Measure acquisition wait, checkout-to-return time and query duration at the same load levels. If holds get longer while queries stay fast, inspect what borrowers do between queries and before returning connections. If holds stay steady and the full pool gains waiters, its connection count bounds throughput for that workload.

## One month of free code review.

New organizations get one calendar month of hosted code review for private and public GitHub repositories. No card or cloud connection required. [Eligibility and fair-use terms](/free-code-review/).

[Start free with GitHub](https://proofline.sh/orgs/plan?offer=free_month)

## Related reading

-   ### [p99 rose and p50 stayed flat. Queueing, or a slow subset?](/learn/p99-up-p50-flat-queueing-or-slow-subset/)
    
    Capacity overruns The Proofline team November 24, 2026 7 min read
    
-   ### [Pool acquire timeout: a busy pool or a struggling database?](/learn/connection-pool-timeout-or-slow-database/)
    
    Capacity overruns The Proofline team November 23, 2026 6 min read
