TCP/IP concurrent connections

Antony Maxwin 281 Reputation points
2021-07-20T12:34:05.367+00:00

Hi When the TCP/IP connections reached 500 , the applications get hanged or getting too much slow, and it speed up slowly when the connection count decreases . So what is the maximum connection that we can have in a Windows server2016, is there anyway we can increase the connection count. ![116352-load.jpg][1] [1]: /api/attachments/116352-load.jpg?platform=QnA

Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,293 questions
Windows Network
Windows Network
Windows: A family of Microsoft operating systems that run across personal computers, tablets, laptops, phones, internet of things devices, self-contained mixed reality headsets, large collaboration screens, and other devices.Network: A group of devices that communicate either wirelessly or via a physical connection.
687 questions
{count} vote

Accepted answer
  1. Sunny Qi 10,916 Reputation points Microsoft Vendor
    2021-07-21T03:23:50.977+00:00

    Hi,

    Thanks for posting in Q&A platform.

    Server is usually fixed to listen on a local port, waiting for a connection request from client. Regardless of address reuse, the local listening port is exclusive even if there are multiple IP on the server side, so only remote IP (i.e. client IP) and remote port (client port) in the server-side TCP connection 4 tuple are variable, so the maximum TCP connection is the number of client IP × the number of client ports, IPv4, regardless of IP address classification and other factors, the maximum number of TCP connections is about 2 of the 32 times (IP number) ×2 of the 16 times (port number), that is, the maximum number of server side stand-alone TCP connections is about 2 of the 48 times.

    The above is given the theoretical maximum number of single-machine connections, in the actual environment, by machine resources, operating system and other limitations, especially the sever side, its maximum concurrent tcp connection number is far from reaching the theoretical upper limit. Maximum TCP connections depends on several factors of our Windows server, it's hard to say an accurate number.

    ----------

    If you are using a high number of TCP connections, particularly with a high connect/disconnect rate, you may exhaust the number of available ports as they may all be in the TIME_WAIT state.

    There are two actions that can prevent this:

    1. Increasing the number of available (ephemeral) ports.

    2. Reducing the TIME_WAIT timeout period.

    ----------

    1. Increasing the number of available (ephemeral) ports.

    By default, Windows only allocates ephemeral ports in the range 1024 through 4999.

    To increase the upper range of ephemeral ports that are dynamically allocated to client TCP/IP socket connections perform the following. You should first save a backup of the registry.

    Start the Registry Editor.
    Browse to, and then select the following key in the registry:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    Create a new DWORD value, or modify the existing value of MaxUserPort to increase the number of ephemeral ports that can by dynamically allocated to clients:
    Value name: MaxUserPorts
    Value data: <Enter a decimal value between 5000 and 65534>
    Save the changes and close the Registry Editor.
    Please note: You must restart your computer for this change to take effect.

    ----------

    2. Reducing the TIME_WAIT Timeout Period

    This setting determines the length of time that a connection will stay in the TIME_WAIT state before being closed. The default is 240 seconds which on a busy server will limit the maximum connections to around 200/sec. Reducing this setting will increase the maximum connection limit.

    Start the Registry Editor.
    Browse to, and then select the following key in the registry:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
    Create a new DWORD value, or modify the existing value of TcpTimedWaitDelay to alter the TIME_WAIT duration:
    Value name: TcpTimedWaitDelay
    Value data: <Enter a decimal value between 30 and 300 seconds>(I would suggest you configure this value to 30)
    Save the changes and close the Registry Editor.
    Please note: You must restart your computer for this change to take effect.

    Hope this will help you.

    Best Regards,
    Sunny

    ----------

    If the Answer is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


3 additional answers

Sort by: Most helpful
  1. Antony Maxwin 281 Reputation points
    2021-07-28T09:36:02.83+00:00

    HI
    Sorry for the late reply
    I have tried the answer, But still the server performance is not incresed. It always stuck on the user connection reaches between 500 and 550,
    is it possible to allow 1000 concurrent connections to server or it depends on the DB performance .
    I have 2 application server( IIS) and One DB server( MSSQL2014), I have problem only with this SQL server, could you please suggest a solution


  2. Lily C L BAI 0 Reputation points
    2023-06-20T02:38:17.67+00:00

    I have tried the answer, But still the server performance is not increased. It always stuck on the user connection reaches between 485 and 500, then its hang and no any new connection can be created.

    Note:

    we have get the below parameter updated and get server rebooted post change, however we still face same issue ,that is connection stuck when ever tcp count reach close to 500.

    TcpNumConnections =0x41fffffe(1107296254)

    TcpTimedWaitDelay =48

    MaxUserPorts=0x0000fffe(65534)

    User's image

    anyone know what might be the reason ?


  3. Lily C L BAI 0 Reputation points
    2023-06-21T07:43:09.01+00:00

    Hi Antony ,

    Thanks for checking,

    Form that server with OS windows server 2026 standard ,there is Pragma fortress software (Version: 5.0 Build 10 Revision 1563 ) installed ,which run as our sftp server .

    there is no big size ( larger than 50MB) uploading/downloading happening.

    and actually at the time of testing , i tested to create 1000+ sftp connections with one sftp account toward the server ( no file uploading/downloading involved ) .

    i run : netstat -n|find /c /i "established" to check the total TCP connection established , i noticed as long as the value reach up to ~ 500, then no new connection can be made even after we have adjusted value for : MaxUserPorts/TcpTimedWaitDelay/TcpNumConnections (the screenshot show the latest value set for our server )

    User's image

    User's image