Fix Your Latency with the Nagle Algorithm
Written: 2010/01/05
This article will first teach you how to disable this notorious 'Nagle Algorithm', and then explain what exactly it is.
Note that this article deals only with Windows XP. If you are using an earlier version the process may be near identical. Newer
versions may require additional steps. I do not provide Vista/7 support.
Disable The Algorithm
This video tutorial should help out most people who are not comfortable with this kind of process. Read along the step-by-step process for
more clarification.
The first step would be to find out some of your connection information. This information will allow you to identify the proper registry key to work
in later. To do this, open up your start menu, go to run, and type in 'cmd' and press enter. A screen similar to the one in the video will pop up. This
is known as the command prompt. In here type:
press enter. This is a command telling your computer to give you information about your network interfaces. The 2 pieces of information we will use to identify the proper interface to change in the registry are the IP address and Default Gateway. It should look like this:
Default Gateway . . . . . . . . . : 13.37.13.37
Put the command prompt aside for now (don't bother closing it just yet), and go back to your start menu. Go to run again, and type in 'regedit'. Press enter.
A window should pop up like in the video, with one side showing 'my computer' and 5 folders under it. This is the registry editor. It's usually not advised to mess around in here unless you know what you're doing. Making mistakes you shouldn't in here can be harmful to your operating system, however in this case, as long as you stay in the areas defined by this tutorial, you should be just fine.
Navigate to this key in the registry
In the interfaces folder you will notice a bunch of nonsensesically named folders with curly brackets {887BF43-AE7889D} ... as a crude example. When you click one of these folders you will notice some information shown on the right side of the screen. This is where step one comes in. Compare the results of your network interface to the information in these folders. To make it even easier, there's usually only one folder that has more stuff than the rest, this one will usually match. Exceptions to this are if you have multiple network interfaces, in which case you will want to either find the one you use for connecting when you game, or follow this guide for all of them.
Once you have located the correct interface, as demonstrated in the video, you're ready for the last step (assuming you're only doing one interface). Right click anywhere except on a name of one of the values in the folder, and then click on 'DWORD value'. This next part is very important. Name the value 'TcpAckFrequency' in exactly this case. The value is case sensitive and a single wrong character case will result in this not working, behaving as if you had not done this at all. After having created the value, right click it and modify. A little box will pop up, change the '0' into a '1'. Hexadecimal or Decimal does not matter, since 1 is the same in both. Once this is done press OK, close the registry editor, and restart your system.
What Exactly is the Nagle Algorithm?
The whole point of the algorithm is to prevent the bandwidth of your network from overloading due to small packets being sent too often. A lot of applications, especially online games (or most applications needing real time data transmission), send many packets containing only a few bytes of data. There's 40 bytes of header data in a TCP/IP packet, which means when a tiny amount of data such as a single byte (for example an on/off instruction for an option in an online game) is sent, you have 40 bytes of 'useless' stuff for a single byte of good data. This can lead to networks being overloaded.

Example of a TCP/IP packet, with the header being 40 bytes, and the data being what you are sending to the server. This is a very simplified diagram of a packet, there's much more to it, including a footer and tons of stuff in the header, but let's keep it simple for the sake of this article.
To solve this problem, the Nagle Algorithm creates a sort of buffer where a packet is sent after it builds up enough data. Typically the data is not sent until either an ACK (acknowledge) is recieved for the previously sent packet, or the maximum segment size is reached (max amount of data that can be handled without being split up into multiple segments).
The main problem with this is that due to this buffering, data is delayed by a few milliseconds, which can have a serious effect on latency sensitive applications such as online gaming. However, disabling this system can cause regular network traffic to overload the available bandwidth. Things such as web browsing can suffer negatively for example. Networks with very high amounts of bandwidth and average useage may not notice much, especially if only one network interface has Nagle disabled, for example your gaming PC.
Recent Articles
Disable autorun on windows to prevent viruses from running and infecting your system....
Release - Easy Command Prompt
A batch file that brings the power of the command prompt to the average user. Ideal for helping the less technologically inclined folks to troubl...
Fix Your Latency with the Nagle Algorithm
Learn how to disable the Nagle Algorithm to fix some of your latency in online gaming....
Quick Levels for Mabinogi Newbies
A little trick for newbies to level quickly in Mabinogi....
Most Annoying Things of the Decade
The things I hated the most these past 10 years....
Search on Osayidan.net
