Skip to content
hashkey.bond

Archivenetworking

Nagle Meets Delayed ACK: 40 ms You Did Not Budget

Two reasonable optimizations combine into latency spikes for small writes.

Published
Reading time
1 min read

Nagle's algorithm reduces tiny packets by holding small writes until previously sent data is acknowledged. Delayed ACK holds acknowledgments for up to ~40 ms hoping to piggyback them on a response. Together, a request/response pattern of small writes can stall for tens of milliseconds.

The classic interaction

  1. Sender writes a small chunk; Nagle holds the next one waiting for an ACK.
  2. Receiver delays the ACK.
  3. Both wait; latency jumps.

Mitigations

  • TCP_NODELAY on latency-sensitive sockets (most RPC and HTTP clients do this).
  • Batch writes yourself so there is no second small chunk.
  • Use TCP_QUICKACK on Linux where appropriate (it is not sticky).

When Nagle helps

Bulk interactive traffic with many tiny writes — telnet-style, some game protocols. For request/response APIs, it is almost always the wrong default.

Takeaway: if your p50 latency has a mysterious ~40 ms floor, check Nagle and delayed ACK before blaming the application.