All Topics
All Topics
Technology
Technology
Design
Design
Programming
Programming
Science
Science
News
News
Gaming
Gaming
Entertainment
Entertainment
Business
Business
Finance
Finance
Sports
Sports
Health
Health
Food
Food
Travel
Travel
Art
Art
Music
Music
Books
Books
Education
Education
Politics
Politics
Personal
Personal
No algorithm. No AI slop. No ads. Just RSS. Pro-human. Indie writers. Real journalism. Open web. Chronological. Hand toasted.

TCP_NODELAY: Why Modern Distributed Systems Should Disable Nagle's Algorithm by Default

By

eieio

5mo ago· 6 min readenInsight

Summary

The article discusses the persistent latency issues in modern distributed systems caused by the default TCP_NODELAY setting, which implements Nagle's algorithm from 1984. The author argues that this algorithm, designed for 1980s network conditions with limited bandwidth and high packet loss, is now counterproductive in today's high-speed, low-latency environments. The article explains how Nagle's algorithm batches small packets to reduce overhead but introduces significant latency, especially in interactive applications. The author advocates for enabling TCP_NODELAY by default in modern systems and suggests that the original problem the algorithm solved (small packet overhead) is no longer relevant with today's network infrastructure.

Key quotes

· 4 pulled
The first thing I check when debugging latency issues in distributed systems is whether TCP_NODELAY is enabled. And it's not just me. Every distributed system builder I know has lost hours to latency issues quickly fixed by enabling this simple socket option, suggesting that the default behavior is wrong, and perhaps that the whole concept is outmoded.
Nagle's algorithm is a simple, elegant solution to a problem that no longer exists. It was designed for a world of 300 baud modems and 10 Mbps Ethernet, where packet overhead was a real concern. Today, we have gigabit Ethernet, 10 gigabit Ethernet, and even 100 gigabit Ethernet. The overhead of a few extra bytes is negligible.
The problem is that Nagle's algorithm introduces latency. It waits for either an ACK from the previous packet or for enough data to fill a full-sized packet before sending. This can add tens or even hundreds of milliseconds to the round-trip time, which is unacceptable in modern distributed systems.
We should be enabling TCP_NODELAY by default. The original problem that Nagle's algorithm was designed to solve—small packet overhead—is no longer a problem. The overhead of a few extra bytes is negligible on modern networks.
Snippet from the RSS feed
It's not the 1980s anymore, thankfully.

You might also wanna read