Increase default listen backlog from 5 to 128

The accept queue was limited to 5 pending connections, which overflows
easily under connection churn or a burst of simultaneous connects (LB
health checks, thundering herd on restart). On overflow the kernel
silently drops the ACK rather than failing fast, so clients stall on
SYN/ACK retransmission backoff.

Benchmark (bombardier -c 10 -d 10s, 3 trials, interleaved with the old
binary) shows max latency dropping from 48-89ms to 5.8-11.2ms, while
p99 is unchanged - the fix affects only the extreme tail, as expected.
This commit is contained in:
yhirose
2026-07-30 17:19:36 -04:00
parent 34b7c846d4
commit 85ec3963bc
+1 -1
View File
@@ -182,7 +182,7 @@
#endif
#ifndef CPPHTTPLIB_LISTEN_BACKLOG
#define CPPHTTPLIB_LISTEN_BACKLOG 5
#define CPPHTTPLIB_LISTEN_BACKLOG 128
#endif
#ifndef CPPHTTPLIB_MAX_LINE_LENGTH