Throughput: Requests, Packets and Bytes per Second
Throughput is work per unit time in whichever unit you are limited by — requests, packets or bytes — and it is tied to latency by Little’s law and bounded by loss and RTT through TCP’s congestion control, so measuring one without the other tells you very little.
You have not marked these as done yet. Read on anyway if they feel familiar; come back to them if something here does not land.
The problem
Three units, three limits
Bytes per second is what a link carries and what iperf and NIC counters report. Packets per second is what NICs, drivers, switches and the kernel network stack process, and every packet costs roughly the same amount of that work whether it holds 64 bytes or 1,500. Requests per second is what an application serves, and each request may be one packet or a thousand. A system can be saturated in any one of the three while the other two look idle, and the diagnosis depends entirely on which.
A 10 Gbit/s link carries ~812,000 packets/s of full 1,500-byte frames, or 14.88 million packets/s of minimum-size 64-byte frames. A Linux kernel doing ordinary socket I/O manages roughly 1–2 million packets/s per core before offloads, XDP or kernel bypass (DPDK) are needed; small-packet workloads — DNS, game state, VoIP, a chatty RPC — hit the pps wall at a tiny fraction of the link’s bandwidth. The symptom is a NIC at 10 % bytes-utilisation with a CPU core pinned in ksoftirqd, and the fix is bigger packets (batching), more cores handling interrupts (RSS), or bypassing the kernel.
- bytes/s: the link, and bulk transfers. Reported by
iperf3,ip -s link,sar -n DEV. - packets/s: the NIC, driver and kernel stack. 1,500-byte frames at 10 Gbit/s ≈ 812 kpps; 64-byte ≈ 14.88 Mpps. Watch
ksoftirqd,/proc/net/softnet_stat. - requests/s: the application. Depends on packets per request and work per request. Reported by the app, the balancer,
wrk/k6.
Throughput and latency: Little’s law
Throughput and latency are distinct but not independent. For any stable system, Little’s law says: average number of requests in flight = throughput × average latency, L = λW. It holds for a single server, a thread pool, a connection pool, a queue, a whole data centre, with no assumptions about distributions. It is the arithmetic behind every capacity question.
Read it in each direction. A service at 1,000 req/s with 200 ms latency has 200 requests in flight at all times; it needs at least 200 concurrent workers, connections or event-loop slots, or it queues. Fix the concurrency and the law gives the ceiling: 50 database connections at 20 ms per query serve at most 2,500 queries/s — and if latency rises to 40 ms under load, the same 50 connections serve 1,250, which is why saturated systems lose throughput exactly when they need it. And a load test that reports 2,000 req/s at 10 ms latency was measuring 20 in flight; production at 800 req/s and 500 ms latency has 400 in flight and a pool of 100 — the pool is the wall, and the CPU never sees the traffic that is waiting for it.
1in_flight = throughput × latency # 1000 req/s × 0.2 s = 200 concurrent2throughput = in_flight / latency # 50 conns / 0.02 s = 2500 req/s max3latency = in_flight / throughput # 400 queued / 800 rps = 0.5 s average wait4 5# the trap: latency rises under load, so capacity falls when it is needed most650 conns / 0.020 s = 2500 req/s 50 conns / 0.040 s = 1250 req/sWhat loss and RTT do to TCP throughput
Above a few Mbit/s the sender is TCP, and TCP’s throughput is set by its congestion window, which loss shrinks and which grows by only one segment per RTT in congestion avoidance (Congestion Control: Protecting the Network). The Mathis relation captures the steady state for classic loss-based congestion control: throughput ≈ (MSS / RTT) × (C / √p), with C ≈ 1.22 and p the packet loss rate. Two facts fall out. Throughput is inversely proportional to RTT — the same loss rate hurts a cross-continent connection 100× more than a same-rack one. And it falls with the square root of loss: 0.01 % loss costs a lot, 1 % is catastrophic.
Numbers: MSS 1,460 bytes, RTT 100 ms. At p = 0.001 (0.1 % loss) the ceiling is ~4.5 Mbit/s; at p = 0.01 (1 %), ~1.4 Mbit/s; at p = 0.0001 (0.01 %), ~14 Mbit/s. On a 10 Gbit/s link. This is why a "slightly lossy" Wi-Fi or a link with a marginal optic makes long-distance transfers crawl while local ones barely notice (Packet Loss: Duplicate ACKs, Fast Retransmit and the RTO), and why BBR — which models bandwidth and RTT instead of reacting to loss — exists. It is also why retransmission and loss counters (ss -ti, nstat -a | grep Retrans) belong next to any throughput measurement.
throughput ≈ (MSS / RTT) × 1.22 / √p
RTT 100 ms: p = 0.01 % → ~14 Mbit/s RTT 1 ms: p = 0.01 % → ~1.4 Gbit/s
p = 0.1 % → ~4.5 Mbit/s p = 0.1 % → ~450 Mbit/s
p = 1 % → ~1.4 Mbit/s p = 1 % → ~140 Mbit/s
same loss, 100× the RTT → 1/100 the throughputMeasuring both
Measure throughput and latency together, always, because either alone hides the other. iperf3 -c host gives raw TCP bytes/s between two hosts (add -P 8 to see whether one stream is window-bound — see Bandwidth vs Latency); iperf3 -u -b 0 -l 64 hammers small UDP packets to find the pps ceiling. ping and ss -ti (rtt:, retrans:, cwnd:) give latency and loss on a live connection. wrk, hey and k6 give requests/s and a latency distribution; report p50, p99 and the concurrency you drove, or the number is meaningless.
The shape to look for: as offered load rises, throughput rises linearly while latency stays flat, then throughput flattens and latency climbs — that knee is capacity, and Little’s law tells you which resource ran out (in-flight = throughput × latency at the knee, compared with your pool sizes). Measuring past the knee produces a throughput number that looks good and a latency number that is unusable, which is how load tests lie.
- Bytes:
iperf3,ip -s link, NIC counters. Packets:sar -n DEV 1(rxpck/s),/proc/net/softnet_stat,ksoftirqdCPU. Requests: app metrics, balancer metrics,wrk/k6with latency percentiles. - On a live TCP connection:
ss -tishowsrtt,cwnd,retrans,bytes_acked— throughput, latency and loss in one line. - Find the knee: raise concurrency until latency starts climbing; that throughput is capacity; in-flight at the knee is the resource that saturated.
Key points
- Throughput has three units — bytes/s (link), packets/s (NIC and kernel), requests/s (application) — and any one can saturate while the others idle.
- Small packets hit the pps ceiling long before the bandwidth ceiling: 64-byte frames are 14.88 Mpps at 10 Gbit/s; a kernel core manages ~1–2 Mpps.
- Little’s law: in-flight = throughput × latency. It sizes pools, exposes hidden queues and explains why capacity falls as latency rises.
- TCP throughput ≈ (MSS/RTT) × 1.22/√loss: inversely proportional to RTT, falling with the square root of loss.
- 0.1 % loss at 100 ms RTT caps a connection at ~4.5 Mbit/s regardless of the link.
- Measure throughput and latency together; capacity is the knee where latency starts to climb.
Why does this exist?
Mechanisms are answers to constraints. Open each question before reading the answer.
▸Why can a NIC be at 10 % and the box still be saturated?
Because the work is per packet, not per byte. Small packets at high rate exhaust the driver and kernel path — softirq CPU — long before the link’s bytes are used.
▸Why does latency rise before throughput falls?
When a resource saturates, requests queue; queueing adds latency first. Throughput only falls once queues overflow or timeouts convert waiting requests into retries.
▸Why does loss hurt long connections more?
After a loss, TCP halves its window and regrows it one segment per RTT. Recovery takes a fixed number of RTTs; at 100× the RTT it takes 100× the time, and the average window over that recovery is what throughput is.
How it fails
What the failure looks like from inside real software.Reference · showHide
- DNS or game server pinned at 100 % on one core with the NIC at 8 % utilisation: pps limit on the softirq path; enable RSS/multi-queue or batch.
- Service capacity in production is 40 % of the load-test figure: the test ran at low latency and low concurrency; production latency × throughput exceeds the connection pool, and requests queue.
- Cross-region replication "only gets 5 Mbit/s on a 1 Gbit/s link": ~0.1 % loss on the path; Mathis ceiling; fix the loss or use multiple streams / BBR.
- Throughput fine, p99 latency terrible: the system is being measured past the knee; every extra request is queued, not served.
- Latency-sensitive traffic collapses when a bulk transfer starts on the same link: the bulk flow fills queues; bufferbloat, see Where the Time Goes: The Request Timeline.
Check yourself
Answer out loud or on paper first, then compare. These come from the interview questions linked to this lesson.
What is the difference between flow control and congestion control in TCP? Who is each one protecting, and how does the sender know the limit?
Show a strong answerHide the answer
Flow control protects the receiver. The receiver advertises in every ACK how much buffer space it has left — the receive window,
rwnd— and the sender may never have more than that many unacknowledged bytes in flight. If the application stops reading from the socket, the buffer fills,rwndshrinks to zero, and the sender stops entirely (probing occasionally with window probes). The signal is explicit and exact; nobody guesses.Congestion control protects the network. No router tells the sender how much capacity is left, so the sender infers it: it keeps a congestion window,
cwnd, grows it while ACKs arrive (exponentially in slow start, then linearly), and cuts it when it detects loss (duplicate ACKs, timeouts) or, with modern algorithms, rising RTT (BBR) or ECN marks. The effective limit at any moment is min(rwnd, cwnd) — whichever side is scarcer.They fail differently and you diagnose them differently. A zero window (
Full interview question, with follow-ups and red flags →ss -tishows a tinyrcv_wndon the peer,tcpdumpshowswin 0) means the receiving application is slow — a slow consumer, a blocked thread, a full downstream — and the fix is in that application (backpressure). A small `cwnd` with retransmissions (ss -tishowscwnd:14 retrans:…) means the path is lossy or congested, and the fix is in the network or in the algorithm (BBR, parallel streams), not in the application. Both make a transfer slow with idle CPUs on both ends; only one of them is your code.Requests to your API take 3 seconds at p99, but the server sits at 5% CPU and the handler itself measures 20 ms. Where can the other 2.98 seconds be, and how would you find them?
Show a strong answerHide the answer
The handler’s 20 ms is measured from the moment the framework calls it — a request has a long life before and after that point, and none of it burns CPU. Lay out the timeline (Where the Time Goes: The Request Timeline): client DNS lookup → TCP handshake → TLS handshake → request bytes cross the network → the kernel’s accept queue → the application’s own queue (thread pool, event loop) → the handler → response bytes written to the socket buffer → transferred to the client → parsed. "Idle CPU plus slow requests" means the request is *waiting*, and each stage has a characteristic wait.
Exact values are fingerprints. A p99 of ~1 s or ~3 s is the signature of a lost SYN: Linux retransmits at 1 s, then 3 s, then 7 s, so a handshake whose first SYN was dropped — by a full accept queue, a conntrack table at capacity, or a firewall — completes at exactly 1 or 3 s (The Three-Way Handshake, TCP Debugging: Reading the Handshake on the Wire). Check
nstat -az TcpExtListenOverflows TcpExtListenDropsandss -ltnfor Recv-Q at the backlog limit. Steps of ~200 ms or multiples are retransmission timeouts on established connections (RTO_MIN, Packet Loss: Duplicate ACKs, Fast Retransmit and the RTO); ~40 ms per small write is the Nagle + delayed-ACK interaction; exactly 5 s is the glibc DNS resolver timeout — the first nameserver inresolv.confis dead or drops UDP, or an AAAA lookup goes unanswered; 1–3 RTTs of extra latency on *every* request means no keep-alive, so each request re-runs the TCP and TLS handshakes (Keep-Alive and Connection Reuse).Queueing without CPU is the other big family. A thread pool of 32 workers all blocked on a downstream call with a 3 s timeout serves 20 ms handlers with a 3 s wait — the thread-pool queue length, not CPU, is the saturated resource (The Thread Pool Server). An event loop stalled on a synchronous call queues everything behind it. A slow client or a small socket buffer makes
write()fast (it copies into the kernel) but the *transfer* slow, so server-side timing ends before the client has received anything; the LB then reports a long response time the app never saw (What Happens When the Receiver Is Slow). And on the client side, browsers queue requests beyond six per host — DevTools shows that as "Stalled" — and a proxy in between may buffer.Find it by measuring each hop, not the handler. From a client:
Full interview question, with follow-ups and red flags →curl -w "%{time_namelookup} %{time_connect} %{time_appconnect} %{time_starttransfer} %{time_total}"splits DNS, TCP, TLS and time-to-first-byte. At the balancer: ALBrequest_processing_time/target_processing_time/response_processing_time, or nginx$request_timeversus$upstream_connect_time,$upstream_header_time,$upstream_response_time— the gap betweenrequest_timeandupstream_response_timeis client or network. On the server:ss -tiforretrans,rtoandcwndper connection, thread-pool and event-loop lag metrics, and a distributed-tracing span opened at the *ingress* rather than in the handler. Compare p50 to p99: a flat p50 with a spiky p99 at round values is a timer; a smeared p99 is a queue.A transfer between two idle servers over a 1 Gbit/s link runs at 9 Mbit/s with 3% loss. Which control is limiting?
Show a strong answerHide the answer
Congestion control: loss keeps cwnd tiny. rwnd is large. Fix the loss, use BBR, or run parallel streams.
Full interview question, with follow-ups and red flags →