Category: 

What is Nagle's Algorithm?

Article Details
  • Written By: John Lister
  • Edited By: Bronwyn Harris
  • Last Modified Date: 07 April 2014
  • Copyright Protected:
    2003-2014
    Conjecture Corporation
  • Print this Article
Free Widgets for your Site/Blog
Artists tend to grow up in wealthier households than doctors.  more...

April 24 ,  2005 :  The world's first cloned dog was born.  more...

Nagle’s algorithm is a system used to improve the efficiency of networks, most notably the Internet. The system involves avoiding data being sent in needlessly small batches, which also increases the number of batches sent. While it has its uses, Nagle’s algorithm can interact poorly with other elements of network communications.

Created by a man named John Nagle, Nagle’s algorithm works with networks which use the TCP/IP protocols. These are protocols, or “rules” for how a network transmits data. While the protocols can apply to any network, they are most commonly associated with the Internet.

The algorithm deals with the way data is transmitted in small chunks, or “packets.” Each packet contains some data plus header information, which is the equivalent of the sender and recipient address on a physical envelope. The packet also contains a checksum, a mathematical equivalent to including a packing list so the recipient knows all the contents of the packet have arrived safely.

Ad

While this system normally works well, it can be inefficient if the chunks of data are particularly small. In extreme cases, the data in a packet may only be one byte, but the header information will take up 40 bytes regardless of the size of the data. This is roughly equivalent to writing a letter to somebody, but then cutting it up and sending each word in a separate envelope. In fact because messages are sent in binary, it’s even more inefficient than this. As well as the waste of bandwidth, this also increases the number of packets which must be sent, which increases the chance of an error occurring in the transmission process.

The principle of Nagle’s algorithm is that after sending a packet, the transmitting computer will wait for one of two things to happen before sending the next packet. If it receives confirmation that the last packet has been received, it will send the data it has immediately, regardless of its size. Otherwise, it will wait until it has a “full” packet to send. Once this happens it will send the full packet whether or not the previous packet has been received.

In some situations, Nagle’s algorithm can do more harm than good. One example is that of online video games which are designed with the assumption that data will be sent immediately. If Nagle’s algorithm is being used, some data will be delayed until a full packet is ready. This can have a noticeable effect on how responsive the game feels to a player and will effectively slow their reaction times compared with other players.

Ad

Discuss this Article

anon92114
Post 1

if TcpAckFrequency=1 is disable

is TcpAckFrequency=0 enable?

or to enable it again do you just delete the line in the registry?

Post your comments

Post Anonymously

Login

username
password
forgot password?

Register

username
password
confirm
email