An algorithm used in implementations of TCP/IP that controls traffic congestion on a network. Nagle’s algorithm limits transmission of small datagrams and controls the size of the Transmission Control Protocol (TCP) sending window.
The algorithm increases the efficiency of routers by reducing the latency of the routing process. It is also an important mechanism for enabling large internetworks such as the Internet to handle TCP/IP applications (such as Telnet applications) that communicate using large numbers of small Internet Protocol (IP) packets.
For example, consider a Telnet client communicating with a Telnet server. When a user types a single character in the Telnet client window, TCP packages the character and sends it to the server as a very small packet. It would be highly inefficient if each character typed into a Telnet window were sent as an individual packet. In fact, when the user types the next character, one of two things can happen:
Another part of Nagle’s algorithm addresses the problem of a network system getting bogged down when a large datagram is sent over and over again because it takes too long to fill a sending window (the receiving buffer) with the data from the datagram.
According to the algorithm, when a client receives a message that datagrams are being dropped because of congestion at a particular host, the client responds by temporarily acting as if the host’s window size has been reduced. This “throttles back” the amount of information sent to the host and enables the host to catch up.
Nagle’s algorithm is defined in Request for Comments (RFC) 896. It is implemented in the TCP/IP protocol stack of the Microsoft Windows NT and Windows 2000 operating systems. Proposals have been put forth for improving this algorithm because it does not produce optimal results with certain kinds of TCP/IP interactions, such as those based on HTTP 1.1.