Improve TCP/IP performance in W2K registry
Published: 08 Oct 2002 14:24 BST
ForwardBufferMemory
Earlier, I showed you how to adjust your MTU value. If you've adjusted your MTU size, you may also want to adjust your forward buffer memory. The forward buffer memory controls how much RAM TCP/IP uses for storing packet data in the router packet queue.
Each packet queue data buffer is 256 bytes long. So, if you choose to set this registry key, the number you specify must be a multiple of 256. The default value is 74,240, which will accommodate 50 1,480-byte packets.
To set the number of packet queue data buffers, create a registry key called ForwardBufferMemory beneath:
HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Services\Tcpip\Parameters
The key must be a DWORD value that's assigned the number of bytes of memory you want to allocate. The minimum value must never be smaller than your MTU size. Therefore, if your MTU size is 1,454, your minimum ForwardBufferMemory size would also be 1,454. The maximum size is 0xFFFFFFFF. However, I recommend keeping the value at a reasonable size.
For example, if your MTU is set to 1,454, I recommend setting ForwardBufferMemory to 50 to 100 times the MTU size. To keep the math easy, 100 times the MTU size of 1,454 would be 145,400. If you divide 145,400 by 256, you get 567.96875. Since 145,400 isn't evenly divisible by 256, take your answer and round it to the next highest whole number, 568. Now, multiply 568 by 256 to get 145,408. This would be the appropriate ForwardBufferMemory setting.
In case you're curious, just because each buffer is 256 bytes doesn't mean that your packets must also be 256 bytes long. When a packet length exceeds the buffer length, multiple buffers are used as needed to accommodate the packet. To save space, the packet's IP header is stored separately.
NumForwardPackets
Another registry key that may be of interest to you is the NumForwardPackets key located at:
HKEY_LOCAL_MACHINE\SYSTEM\
CurrentControlSet\Services\Tcpip\Parameters
This registry key determines the number of IP packet headers that are designated for the router packet queue. It's a good idea to set this key to a fairly high value because when all allocated header space is used, TCP/IP will begin to randomly discard packets from the queue.
Like many of the other registry keys that we've looked at so far, the NumForwardPackets key doesn't exist by default. When creating this registry key, you should make the key a DWORD and assign it a number that will represent the maximum number of packet headers to store in the TCP/IP queue. If you choose not to create this registry key, Windows will use a default value of 50.
Setting an optimal value for the NumForwardPackets key can be tricky. The minimum size you should set this value to is the ForwardBufferMemory size divided by the largest IP data size.
The maximum NumForwardPackets value should be based on the ForwardBufferMemory value divided by the maximum IP packet size. Because the maximum IP data buffer size is 256, I recommend determining the maximum NumForwardPackets value by dividing the ForwardBufferMemory by 256. Earlier, I suggested setting the ForwardBufferMemory to 145,408. This means that the highest value you'd want to use would be 568, assuming you had an MTU size of 1,454 and were basing your ForwardBufferMemory size on 100 times the MTU size rounded to the next highest multiple of 256.
As you can see, there's a huge difference between Windows' default value of 50 and my maximum value of 568. I recommend going with the maximum value. Just remember to do the math and pick the true maximum value, rather than just using my numbers. There's no reason you can't use a number below the maximum value as long as you're above the minimum value. But if you go above the maximum value, you're wasting memory.





