Nagle's algorithm

Named for its creator, John Nagle, the Nagle algorithm is used to automatically concatenate a number of small buffer messages; this process (called nagling) increases the efficiency of a network application system by decreasing the number of packets that must be sent. Nagle's algorithm, defined in 1984 as Ford Aerospace and Communications Corporation Congestion Control in IP/TCP Internetworks (IETF RFC 896) was originally designed to relieve congestion for a private TCP/IP network operated by Ford, but has since been broadly deployed.

Nagle's document specified a means of dealing with what he called the small packet problem, created when an application generates data one byte at a time, causing the network to be overloaded with packets (a situation often referred to as send-side silly window syndrome). A single character - one byte of data - originating from a keyboard could result in the transmission of a 41 byte packet consisting of one byte of useful information and 40 bytes of header data. This situation translates into 4000% overhead, which was considered to be acceptable for a lightly loaded network such as the Advanced Research Projects Agency Network (ARPANet - the precursor of the Internet operating at that time), but not so for a heavily loaded network such as Ford's, where it could necessitate retransmissions, cause lost packets, and hamper propagation speed through excessive congestion in switching nodes and gateways. Throughput could be hampered to the extent that connections were aborted. Nagle's algorithm - usually implemented through the insertion of two lines of code into a TCP program - instructs the sender to buffer (store) data if any unacknowledged data is outstanding. Any data sent subsequently is held until the outstanding data is acknowledged (ACKed) or until there is a full packet's worth of data to send.

Although Nagle's algorithm addressed problems that were being experienced within Ford's network, the same problems were beginning to be experienced by ARPANet. Nagling has been broadly implemented across networks, including the Internet, and is generally performed by default - although it is sometimes considered to be undesirable in highly interactive environments, such as some client/server situations. In such cases, nagling may be turned off through use of the TCP_NODELAY sockets option.

This was last updated in April 2007

Continue Reading About Nagle's algorithm

Dig Deeper on Network protocols and standards