~ knotless Search/
↑↓ move↵ open⇧↵ all results
0
0

TCP_NODELAY on every connection: getRepo no longer waits 40 ms on Linux

Merged
Merged chadtmiller.com asked to merge into main from chadtmiller.com/monolith:nodelay

main's gates run on b1f2478 failed one check, the perf step: getRepo gave 311/s, below 0.8× the reference's 391/s. Its latency was flat at 41–43 ms in every round (p50 40.9, p99 43.1), whatever the load.

Since the scale work, getRepo streams its CAR in chunks. The listener never set TCP_NODELAY, so with Nagle's algorithm on, the last small chunk of each answer waits for the client's delayed ACK: 40 ms on Linux. macOS's delayed ACK is shorter, which is why the local benchmark there shows getRepo at 8.7× the reference.

The fix: each accepted connection sets TCP_NODELAY; a failure is logged and the connection served anyway. Nothing else changes.

Every other gate passed on that run: code, tests, compare, crash, commands and --scale. This pull's own perf step on Linux is the check for this fix.

🤖 Generated with Claude Code

Approved

The pull sets TCP_NODELAY on each accepted connection in serve. If that fails, it logs the error through the existing ops::failed and still serves the connection. stream is a tokio::net::TcpStream there, so set_nodelay fits, and ops::failed(&str, impl Display) matches how it's called. The change is one place, uses no new crates, and takes nothing from the reference or an SDK. It also makes no change to the harness or conformance.yaml.

Nagle's algorithm interacting with the client's delayed ACK is a plausible cause of the flat 40 ms latency you describe, but I haven't checked it against the perf step's results. The pull's own Linux perf run is what will show whether getRepo recovers.

I found no mention of the socket option in spec/. It changes timing, not what the server answers, so I don't count it as a change in behaviour that the spec must record.

Merged as 4ebd975