Optimizing the TCP/IP stack can significantly improve network performance, connection handling, and stability on Windows servers, especially under high load or with proxy, or high-concurrency applications.

Below are recommended TCP stack tuning settings and an explanation of their purpose.

By default, Windows TCP settings are designed for general use. On servers handling many simultaneous connections, these defaults may lead to:

  • Slow connection reuse
  • Port exhaustion
  • High TIME_WAIT states
  • Reduced throughput

Proper tuning helps the server:

  • Handle more concurrent connections
  • Recover faster from closed sessions
  • Improve overall network responsiveness

Apply the following commands using Command Prompt as Administrator.

reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v TcpTimedWaitDelay /t REG_DWORD /d 0x0000001e
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v StrictTimeWaitSeqCheck /t REG_DWORD /d 0x00000001
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v MaxFreeTcbs /t REG_DWORD /d 0x00011940
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v MaxHashTableSize /t REG_DWORD /d 0x0000ffff
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v TcpWindowSize /t REG_DWORD /d 0x0000ffff
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v EnableDynamicBacklog /t REG_DWORD /d 0x00000001
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v MinimumDynamicBacklog /t REG_DWORD /d 0x00000032
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v MaximumDynamicBacklog /t REG_DWORD /d 0x000003eb
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v DynamicBacklogGrowthDelta /t REG_DWORD /d 0x0000000a
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpAckFrequency" /v TcpAckFrequency /t REG_DWORD /d 0x00000001
reg add "HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters" /v MaxUserPort /t REG_DWORD /d 0x0000ffff

Dynamic Port Range Optimization

To prevent port exhaustion and allow more outbound connections, expand the dynamic port range:

netsh int ipv4 set dynamicportrange protocol=tcp startport=1025 numberofports=64508 store=persistent
netsh int ipv4 set dynamicportrange protocol=udp startport=1025 numberofports=64508 store=persistent