Commit 419eee8
fix: deepen TCP listen backlog to cut connection-setup tail latency (#395)
A single listener thread accepts every client connection. Under a burst
of short-lived, non-keep-alive requests (e.g. the concurrency experiment
driving the empty workload), the 128-entry accept queue overflows, the
kernel drops the connection, and the client only retries after the ~1s
initial SYN RTO -- producing a sharp ~1s tail-latency spike.
Raise the listen backlog to 4096. The kernel silently caps it to
/proc/sys/net/core/somaxconn, so requesting more than the host allows is
harmless. Drop the now-redundant compile-time truncation warning and
explain the rationale in the comment.
Verified with hey against the empty workload at c=200, 50k requests:
backlog 128 : p99.9=1084ms, max=1109ms, 202 requests >1s
backlog 4096: p99.9= 283ms, max= 292ms, 0 requests >1s
At c=1..100 the tail was already clean in both cases (no >1s); this
removes the spike that appears once the connection-setup burst exceeds
the old backlog.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 309771a commit 419eee8
1 file changed
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
18 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
19 | 22 | | |
20 | | - | |
21 | | - | |
22 | | - | |
| 23 | + | |
| 24 | + | |
23 | 25 | | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
29 | 27 | | |
30 | 28 | | |
31 | 29 | | |
| |||
0 commit comments