본문 바로가기

Software/Network

[Network] TCP Optimizer

From : http://www.speedguide.net/downloads.php

Table of Contents

1. Introduction
2. Using the program
3. General Settings

    3.1 Connection Speed slider
    3.2 Network Adapter selection
    3.3 TCP Receive Window
    3.4 MTU Discovery
    3.5 Black Hole Detect
    3.6 Selective ACKs
    3.7 Max Duplicate ACKs
    3.8 Time to Live
    3.9 TCP 1323 Options
4. Advanced settings
    4.1 Internet Explorer Optimization
    4.2 Host Resolution Priority
    4.3 Type/Quality of Service
    4.4 DNS Error Caching
    4.5 LAN Browsing speedup
    4.6 LAN Request Buffer Size
5. Largest MTU
6. BDP
7. Latency
8. Registry
9. Menus

    9.1 File Menu
    9.2 Preferences Menu
Appendix A - Program Changes



1. Introduction

The TCP Optimizer is a program designed to provide an easy, intuitive interface for tuning TCP and IP related parameters in the Windows Registry. It takes into account all related RFCs, the Microsoft TCP/IP implementation oddities, verifies all Registry locations for the same TCP/IP parameters (ICS Sharing, AOL protocol MTU, etc), only ads the necessary Registry parameters, and overall aids in making the whole "tweaking for speed" experience a breeze. It is downloadable from here: SG TCP Optimizer.

In the following chapters, you will find short descriptions of all the settings and all aspects of the functionality of the TCP Optimizer. In addition to this documentation, you can also check the TCP Optimizer FAQ, as well as the SG Tweaking forum. We'd also appreciate any feedback about the program, please contact the webmaster or post in our forums with any suggestions for additions or changes to either the program or this documentation.



2. Using the program

If you do not feel like reading the entire documentation below, or you simply need the tweaks NOW, without spending time in learning the meaning of all those settings, you can use the Optimizer by following these short instructions:

- Choose your maximum Connection Speed from the slider bar (the maximum available bandwidth, in kilobits per second)
- Choose your Network Interface, or check to Modify All Network Adapters
- Pick "Optimal settings" from the radio-buttons near the bottom of the program
- Click on the "Apply changes" button and reboot

사용자 삽입 이미지
 

The Optimizer can do all the rest for you (including a backup of the current registry settings, so you can revert the changes if you wish). The new version of the program includes a preview of all changes after hitting the "Apply changes" button and before actually editing the Windows Registry.

You can also use the Optimizer to easily apply custom values, test with different settings, and learn a bit more about tweaking and TCP/IP in general. We strongly recommend getting familiar with the settings, and learning what aspects of your connection they affect first. Also, note that some of the program tabs (Largest MTU, BDP, Latency) can be used as a learning tool without making any changes to the Windows Registry.

The 3 radio buttons at the bottom of the program show the relevant "Current settings" as set in the Windows Registry, the Optimizer recommended "Optimal settings", or allow for "Custom settings" for the more advanced user to test with different values.

Please see the following chapters for definitions and detailed descriptions of all options in the TCP Optimizer.

Note: You should be logged in with an account with administrative privileges to be able to write to some of the Registry keys and use the program to its full potential.


3. General Settings

This tab contains all the important tweakable TCP/IP parameters.

사용자 삽입 이미지

Connection Speed (in kilobits per second) - you have to choose your maximum available bandwidth here. The Optimizer will base any "Optimal settings" recommendations on the connection speed you choose in this slider bar. Please note it is an approximation of your maximum available bandwidth, it does not have to be exact.

Network Adapter selection - you should have a list of all present network interfaces in the system. When you select an adapter, using this pull-down menu, its IP address will be shown in the lower-right of this section. Note you can also choose to modify all network adapters at the same time, or tweak without modifying any of their settings.

You also have the option to type a a custom MTU value (that will be used to recommend RWIN). Generally, MTU can safely be set at 1500, however some types of connections, and some routers use smaller values. It is only necessary to edit the MTU value in such special cases. For example, the maximum MTU value for Windows XP PPPoE encapsulation is 1480 (even though other PPPoE implementations can use as high as 1492).

Note: In some rare cases, it is possible that your desired network device is not correctly identified by the Optimizer. That does not affect the program performance much, and you should simply choose "Modify All Network Adapters" in such cases. We'd also appreciate you contacting us with the exact device, so we can improve the program.

TCP Receive Window (a.k.a. RWIN) - this buffer is the single most important factor in tweaking your TCP/IP parameters. A small RWIN value limits your maximum throughput (the server waits for acknowledgements of received packets), one much larger than needed by your connection can have a negative effect on your connection as well. Here is some history on RWIN, and all the considerations in choosing an "optimal" value:

Originally, when the TCP protocol was developed, there were only 16 bits in the TCP header reserved for the size of this buffer, allowing for a maximum value of 2^16 (65535, if you start counting from 0). With faster high-latency networks this value proved insufficient, and RFC 1323 introduced additional "TCP Options", allowing for larger RWIN values. It is accomplished by bit shifting, or multiplying the original unscaled RWIN value (up to 65535 bytes) in the TCP header by a scale factor, power of 2.

The TCP Optimizer recommends an optimal TCP Window value considering all the following factors:

- Bandwidth * Delay product based on the chosen maximum connection speed and maximum anticipated latency.
- RWIN (both scaled and unscaled) multiple of MSS, for maximum optimization.
- Proper RFC 1323 scaling for RWIN values larger than 65535.
- largest optimal unscaled RWIN (MSS multiple) used for all RWIN values over 65535.

MTU Discovery (RFC 1191, EnablePMTUDiscovery) - We recommend enabling (choosing "Yes") this setting.
MTU Discovery determines whether TCP uses a fixed, default maximum transmission unit (MTU) or attempts to find the actual MTU. In some versions of Windows, if MTU Discovery is disabled the OS uses an MTU of 576 bytes for all connections to computers outside of the local subnet. If enabled, TCP attempts to discover the MTU (largest packet size) over the path to a remote host.

Black Hole Detect (EnablePMTUBHDetect) - The recommended optimal setting in the TCP Optimizer is "No".
Enabling this setting causes TCP to try to detect black hole routers while doing Path MTU Discovery. A black hole router does not return ICMP Destination Unreachable messages when it needs to fragment an IP datagram with the Don't Fragment bit set. TCP depends on receiving these messages to perform Path MTU Discovery. With this feature enabled, TCP tries to send segments without the Don't Fragment bit set if several retransmissions of a segment go unacknowledged. If the segment is acknowledged as a result, the MSS is decreased and the Don't Fragment bit is set in future packets on the connection. Enabling black hole detection increases the maximum number of retransmissions that are performed for a given segment. Unless you are dealing with a relatively archaic network, or running a server, this setting does not make much visible difference, and can in fact waste bandwidth if enabled.

Selective ACKs (SackOpts) - the recommended setting is "Yes".
This parameter controls whether or not SACK (Selective Acknowledgement) support is enabled, as specified in RFC 2018. SACK is especially important for connections using large TCP Window sizes.

Max Duplicate ACKs (TcpMaxDupAcks) - range is 1-3, the recommended value is 2.
This parameter determines the number of duplicate ACKs (acknowledgements) that must be received for the same sequence number of sent data before "fast retransmit" is triggered to resend the segment that has been dropped in transit.

Time to Live (TTL, DefaultTTL) - recommended value is 64.
This setting specifies the default time-to-live (TTL) value set in the header of outgoing IP packets. The TTL determines the maximum amount of time in seconds (and the number of hops) that an IP packet may live in the network without reaching its destination. It is effectively a limit on the number of routers that an IP packet is allowed to pass through before being discarded. It does not directly affect speed, however a value that's too small can cause packets to be unable to reach distant servers at all. A very large value, on the other hand might take too long to recognize lost packets.

TCP 1323 Options (TCP1323Opts) - we recommend having only "Window Scaling" enabled.
This parameter controls RFC 1323 time stamps and window-scaling options. The "Window Scaling" part allows for RWIN (TCP Window) values over 65535. Timestamps add another 12 bytes to the header of each packet, and are only necessary in connections with increased packet loss.



4. Advanced Settings

사용자 삽입 이미지

This tab contains additional tweaks, that have a smaller, but still noticeable effect on TCP/IP performance. Generally, the tweaks on this page are not directly related to throughput. Some of the tweaks in this section of the Optimizer might be related only to specific aspects of networking, such as Web, or LAN browsing, hostname resolution speed, etc.

Internet Explorer OptimizationBy default, the HTTP 1.1 specs allow for only 2 concurrent connections to a Web server. That means, while downloading a web page you can only get 2 files at a time. Note that a single page usually includes tens (sometimes hundreds) of images, each initiating a separate request to the server. Increasing the default to ~10 can provide a considerable visible boost in web page loading time, especially for broadband internet connections. There are two parameters in this section, MaxConnectionsPerServer, and MaxConnectionsPer1_0Server, corresponding to HTTP 1.1 and 1.0, respectively. We recommend setting both to the same number, between 4 and 10.

Host Resolution Priority
This section improves DNS and hostname resolution in general. It helps web pages load faster, and has negligible effect on downloads. For more information on what/how this tweak operates, check our Host Resolution Priority Tweak article. We recommend using the Optimal values (5,6,7,9).

Type/Quality of Service
QoS (Quality of Service) and ToS (Type of Service) have to do with support for priority traffic.

QoS is enabled by default in Windows XP, and can limit available bandwidth in order to accommodate high-priority traffic, when present. The Optimizer only changes the QoS value if it is already present in the registry. It is in the Registry only if the QoS Packet Scheduler is installed (can be added from the Network Adapter Properties). We recommend having the QoS Packet Scheduler uninstalled, or/and setting the QoS: NonBestEffortLimit Optimizer setting to 0%.

ToS (Type of Service, RFC 791, RFC 1812) is a field of the IP header, designed to also carry quality of service features, such as prioritized delivery for IP datagrams. It is not widely used, and it has been redefined and superseded by a newer standard called Differentiated Services (DiffServ) and defined in  RFC 2474 , RFC 2475, RFC 2597, RFC 2598. DiffServ increases the number of definable priority levels by reallocating bits of an IP packet for priority marking. The TCP Optimizer allows for ToS/DiffServ editing, although it is an advanced setting, probably beyond the scope of regular residential broadband tweaking. If you feel comfortable editing this value, you might also want to note possible conflicts with using some ToS values in a DiffServ environment, as described in RFC 2873.

ToS other than 0 is only available if ToS: DisableUserTOSSetting is present, and set to "0" in the Optimizer. If enabled, the ToS: DefaultTOSValue can be set to a specific number, (which is probably beyond the scope of this help file, but is somewhat explained below - feel free to read the related RFCs referenced above for more info). If we must make a recommendation, here are some good DefaultTOSValue numbers that are valid, and with high precedence in both ToS and DiffServ environments:

  1. DefaultTOSValue = 80 - (010 100 00 binary). This setting should be tried first. It is not very aggressive, but it takes precedence over regular traffic and asks for low delay. For ToS, you get immediate precedence, low delay. For DiffServ, you get AF22 - class 2 traffic, medium drop probability.
  2. DefaultTOSValue = 136 - (100 010 00 binary). This is a moderately aggressive precedence setting. For ToS, you get flash override precedence, high throughput. For DiffServ, you get AF41 - class 4 traffic, low drop probability.
  3. DefaultTOSValue = 184 - (101 110 00 binary). This is a very aggressive setting, that might introduce some packet loss - it is usually only recommended for audio/video applications. For ToS, you get critical precedence, low delay, high throughput. For DiffServ, you get EF - Expedited Forwarding, high priority traffic, but with higher drop probability.

The tables below explain the ToS and DiffServ values in more detail so you can choose your own numbers

ToS Field in Detail:

bit 0 1 2 3 4 5 6 7
Precedence

000 (0) - routine
001 (1) - priority
010 (2) - immediate
011 (3) - flash
100 (4) - flash override
101 (5) - critical
110 (6) - Internetwork Control
111 (7) - Network Control
Delay

0 - normal
1 - low
Throughput

0 - normal
1 - high
Reliability

0 - normal
1 - high
Cost

0 - normal
1 - low
MBZ

checking bit
(Must Be Zero)

Note: The field is 8 bits in the IP header, first 3 define precedence, then one each for delay, throughput, reliability, cost and a checking bit as illustrated by the table above.

DiffServ Field:

bit 0 1 2 3 4 5 6 7
DSCP (Differentiated Services Codepoint)
 
Class selection is in the first 3 bits, and maps directly to the IP Precedence bits from the ToS table above.
CU
 
Currently unused, best kept at 00 for backward compatibility with ToS.


DiffServ Codepoints (first 6 bits) in order of precedence:

Name Codepoint
(CU)
DiffServ
(decimal)
RFC
#
Notes
CS0 000 000 (00) 0 2474 class 0, default (routine)
CS1 001 000 (00) 32 2474 class 1 - similar to the ToS Precedence (priority)
AF11 001 010 (00) 40 2597 AF (Assured Forwarding) class 1 - low drop precedence
AF12 001 100 (00) 48 2597 AF class 1 - medium drop precedence
AF13 001 110 (00) 56 2597 AF class 1 - high drop precedence
CS2 010 000 (00) 64 2474 class 2 - similar to the ToS Precedence (immediate)
AF21 010 010 (00) 72 2597 AF class 2 - low drop precedence
AF22 010 100 (00) 80 2597 AF class 2 - medium drop precedence
AF23 010 110 (00) 88 2597 AF class 2 - high drop precedence
CS3 011 000 (00) 96 2474 class 3 - similar to the ToS Precedence (flash)
AF31 011 010 (00) 104 2597 AF class 3 - low drop precedence
AF32 011 100 (00) 112 2597 AF class 3 - medium drop precedence
AF33 011 110 (00) 120 2597 AF class 3 - high drop precedence
CS4 100 000 (00) 128 2474 class 4 - similar to the ToS Precedence (flash override)
AF41 100 010 (00) 136 2597 AF class 4 - low drop precedence
AF42 100 100 (00) 144 2597 AF class 4 - medium drop precedence
AF43 100 110 (00) 152 2597 AF class 4 - high drop precedence
CS5 101 000 (00) 160 2474 class 5 - similar to the ToS Precedence (critical)
EF PHB 101 110 (00) 184 2598 Expedited Forwarding (recommended for video/audio - high priority, higher drop probability)
CS6 110 000 (00) 192 2474 class 6 - similar to the ToS Precedence (Internetwork Control)
CS7 111 000 (00) 224 2474 class 7 - similar to the ToS Precedence (Network Control)

Notes:
- The DiffServ column shows the 8-bit decimal equivalent that should be used in the TCP Optimizer for the "DefaultTOSValue". The value is obtained by appending two 0s to the 6-bit DiffServ codepoints. Note to set any ToS other than 0 in the Optimizer, you also need to set "DisableUserTOSSetting" to "0" (non-empty zero value).
- Higher class traffic takes precedence. Values not in the above table can get reset to the default (0), or have the connection reset.
- Some routers may change, or reset the ToS/DiffServ value to 0 regardless of the setting.


DNS Error Caching
Windows has built-in DNS (Domain Name System) caching, which basically caches resolved hostnames for faster access and fewer DNS lookups. This is generally a great feature, with the only downside that failed DNS lookups get cached by default as well... When a DNS lookup fails (due to temporary DNS problems), Windows still caches the unsuccessful DNS query, and in turn fails to connect to a host regardless of the fact that the DNS server might be able to handle your lookup seconds later. One can manually flush failed DNS lookups by typing ipconfig /flushdns in Command prompt... Or you can simply set the 3 values in the Optimizer to "0", and it will set the relevant Registry settings.

Note:  Seems Microsoft changed the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\NegativeCacheTime Registry entry in Windows 2000to HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters\MaxNegativeCacheTtl in Windows XP and 2003 server. We have updated this in the 2.02 version of the program.

LAN Browsing speedup (disabling the Network Task Scheduler)
This tweak disables searching networked computers for scheduled tasks (when set to "Optimized" in the program). It reduces the long wait when opening network folders, and speeds up LAN browsing.

LAN Request Buffer Size (reduces network delay)
In higher latency Networks, delays may be encountered with the default request buffer size (4356 decimal). The range of this parameter is 1024 - 65535 bytes. Testing has shown that, in most standard Ethernet environments, if memory is available 16384 bytes is a better choice. This tweak only applies to LANs, and helps with slow browsing of large directories.



5. Largest MTU

사용자 삽입 이미지

This section aids in finding the largest possible non-fragmented packet between your PC, and a server. You can specify an URL, click Start, and have the program ping the specified server with different packet sizes, until it finds the largest possible packet before fragmentation occurs. The largest non-fragmented MTU is important in that it represents the optimal MTU value on that particular path.

A large MTU value helps in maximizing data vs. header size for a particular data segment. Fragmentation and reassembling of packets can cause slowdowns, and introduces more header overhead as well. That is why the largest non-fragmented MTU value for your network connection is a significant factor in tweaking. Once the program finds the largest non-fragmented packet, it can be plugged in the MTU value in the General Settings tab.

Note that for this to work, it is best to set your MTU value to 1500 temporarily, since the largest non-fragmented MTU us also bound by the MTU value on your end.



6. BDP (Bandwidth * Delay Product)

사용자 삽입 이미지

This section contains a Bandwidth * Delay calculator. The BDP is a very important concept in TCP/IP Networking. It is directly related to the TCP Window (RWIN) value, in that it represents a limit to the possible throughput. BDP plays an especially important role in high-speed / high-latency networks, such as most broadband internet connections. It is one of the most important factors of tweaking TCP in order to tune systems to the type of network used.

The Bandwidth*Delay Product, or BDP for short determines the amount of data that can be in transit in the network. It is the product of the available bandwidth and the latency, or RTT.

The BDP simply states that:

BDP (bits) = total_available_bandwidth (bits/sec) x round_trip_time (sec)

or, since RWIN/BDP is usually in bytes, and latency is measured in milliseconds:

BDP (bytes) = total_available_bandwidth (KBytes/sec) x round_trip_time (ms)

What does in all mean ? The TCP Window is a buffer that determines how much data can be transferred before the server waits for acknowledgement. It is in essence bound by the BDP. If the BDP (or RWIN) is lower than the product of the latency and available bandwidth, we can't fill the line since the client can't send acknowledgements back fast enough. A transmission can't exceed the (RWIN / latency) value, so RWIN needs to be large enough to fit the maximum_available_bandwidth x maximum_anticipaded_delay.



7. Latency

사용자 삽입 이미지

This section of the program is simply a tool for testing the latency of your network/internet connection. You can choose a number of hosts, a number of pings per host, and ICMP packet size. After clicking start, the tool will consecutively ping all hosts, then provide maximum and average latency measurements in milliseconds, as well as packet loss indication (if present).

This tool can be used to effectively estimate the maximum anticipated latency for BDP/RWIN calculations. In order to do that, we recommend using a larger number of hosts than the default 5, and a larger packet size (since larger packets tend to have a bit higher latency). Then, as an estimate of your maximum anticipated latency, rather than using the Maximum RTT, use the average RTT, multiplied by two.


Notes:

  • Pinging hosts uses ICMP, rather than TCP. Some routers give very low priority to ICMP traffic, and as a result you may experience a higher percentage of packet loss.
  • Larger packets have a bit higher latency
  • RTT varies with time of day, network congestion, etc.
  • Some nodes might choose to drop repeated ICMP requests when congested, or ignore them all together.


8. Registry

사용자 삽입 이미지

This section of the Optimizer has been improved to include an actual Registry Editor. It is a direct interface to the Windows Registry, and only intended for advanced use ! Please only use it carefully, and at your own risk.

Note that the Registry editor only includes TCP/IP, and some related hives of the Windows Registry.

To use it, simply navigate to the appropriate key you wish to edit in the left section of the editor, then work in the right section, by either choosing a value/key and editing it, or adding a new one. All available actions for the currently active window/key/value are reachable by right-clicking on them.



9. Menus

사용자 삽입 이미지

The File Pull-down menu contains a number of options for backing up, as well as exporting and importing all the related TCP Optimizer settings. Those options can be shared between users, they contain information about empty keys, values to remove/add/edit and all relevant parameters to clone the exact state of the related settings to another machine, or save them for your own reference later.

The Preferences menu, pictured on the right has two sections. The first one, "Maximum Latency" is a number in milliseconds, that is used in calculating the optimal RWIN value. It affects all the "Optimal settings" recommendations of the program, so if you're not sure what it does, leave it at the default 500ms. Basically, the larger this number, the larger RWIN values the program is going to recommend under "Optimal settings" for the same connection speed, and vice versa.

The second section in the Preferences menu, "Latency tab: hosts to ping" contains a list of URLs, used in the Latency section of the program for measuring current RTT (round trip time, delay, ping, latency) to multiple hosts.

The Help Menu of The Optimizer simply contains a link to this documentation, as well as the Software License Agreement, and some general information about the program.




Appendix A - Program Changes


Changes in TCP Optimizer v. 2.0.3 :

  • Under Optimal or Custom mode, when PPPoE is checked, and the MTU is not modified manually, the displayed 1492 MTU is now correctly applied to the Registry.
  • If MTU is set to a value outside the valid range, and the user changes current/optimal/custom mode, the value is now properly reset to 1500.
  • The Latency tab will account for, and discard incorrect negative RTT values sometimes returned by servers. Such values will no longer count towards the min/max/avg calculations.

Changes in TCP Optimizer v. 2.0.2 :

  • Added all virtual Network Adapters to the list of NICs.
  • Changed the NegativeCacheTime Windows 2000 entry to MaxNegativeCacheTtl for Windows XP and 2003 Server (DNS Caching).
  • Added Scaled RWIN and Tcp1323 Options for Windows 95 machines as requested (a MS update to Windows 95 is also necessary for this to work)
  • Removed the ToS/QoS control box frame, LAN Browsing speedup, and LAN Request Buffer size from Windows 9x Advanced settings.
  • Changed custom mode to display the current values by default, rather than optimal ones.
  • Fixed the Windows 9x Advanced settings optimal/custom modes to display the correct Host Resolution Priorityy
  • Fixed the RWIN calculation to take into account custom latency selection after program restart.
  • Updated the Windows 9x RWIN calculation to match the Windows XP/2k/2k3 algorithm

Changes in TCP Optimizer v. 2.0.1 :

  • Fixed a bug where DefaultTTL was set to "0" instead of "64" under "Optimal settings" in Windows 9x.
  • Fixed the "LAN Browsing speedup" to correctly show "Optimized" under current settings when applicable.
  • Changed "Connection speed" slider bar to accommodate faster broadband connections as per users' requests.
  • Changed "Connection speed" slider bar to retain last user-selected speed setting after program restart.

Changes in TCP Optimizer v. 2.0.0 (from version 1.0):

  • Added a new tab with a BDP (Bandwidth*Delay Product) calculator
  • Registry tab is now an editor, users can edit/add/delete keys in related hives.
  • Changed the connection speed to a more flexible slider bar.
  • Changed the RWIN calculation to reflect various speeds, optimal RWIN is now recalculated on the fly.
  • Added Afd check for the RWIN value, to avoid confusion with XP SP2.
  • Enabled custom MTU values under "Optimal settings."
  • Added check for AOL and PPPoE "Protocol MTU" for clients that have, or have had AOL installed.
  • Added QoS / ToS editing to the "Advanced settings" tab.
  • Added DNS error caching fix
  • Added Host Resolution Priority tweak
  • Added LAN "Request Buffer Size" tweak
  • Automatic backup of related registry keys before changing any values.
  • Expanded the import/export/backup capabilities.
  • Added "Preferences" to the program, users can now choose URLs for the Latency tab, as well as "maximum anticipated delay" for RWIN calculations.
  • Added a preview of changes, after clicking "Apply changes" and before they're actually applied.
  • Added this documentation.