Nagle algorithm

from Wikipedia, the free encyclopedia

The Nagle algorithm is an algorithm that is used in computer networks with the TCP network protocol .

The Nagle algorithm is intended to prevent packets that are too small , since many small packets reduce the throughput of the connection. This results from the fact that a header with a fixed size is created for each packet . In this way, the header is more significant for many small packets.

The Nagle algorithm works as follows:

  • If a package is full, send it.
  • If a package is not full, send it as long as the recipient has confirmed all packages sent so far.

If this behavior is not desired, the Nagle algorithm can be switched off under POSIX -compatible operating systems and under Windows with the setsockopt option TCP_NODELAY. In practice, this is done, for example, with interactive session protocols such as Telnet or SSH , in order to shorten the reaction time of the other party to keystrokes or screen outputs.

The exact definition can also be found in RFC 896 and RFC 1122 .

The Nagle algorithm is named after John Nagle.