Maximum number of TCP connections per host in Windows

Source: Internet
Author: User

During Socket programming, we often ask how many TCP connections can be established on a single machine at most. This article describes how to adjust system parameters to adjust the maximum number of TCP connections on a single machine.

In Windows, the number of TCP connections on a single machine is determined by multiple parameters. The following describes them one by one:

Maximum number of TCP connections

[HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ Tcpip \ Parameters]
TcpNumConnections = 0x00fffffe (Default = 16,777,214)

 

The preceding Registry Information configures the maximum number of TCP connections allowed for a single machine. The default value is 16 Mb. This value seems to be very large. This is not the only condition for limiting the maximum number of connections. There are other conditions that will limit the maximum number of connections to the TCP connection.

Maximum number of dynamic ports

When the TCP client is connected to the server, the client must allocate a dynamic port. By default, the allocation range of this dynamic port is 1024-5000, that is, by default, the client can initiate up to 3977 Socket connections at the same time. Modify the following registry to adjust the range of the dynamic port.

[HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ Tcpip \ Parameters]
MaxUserPort = 5000 (Default = 5000, Max = 65534)

 

Maximum TCB count

The system assigns a TCP control block or TCB to each TCP connection. This control block is used to cache some TCP connection parameters, each TCB needs to allocate a 0.5 KB pagepool and a KB Non-pagepool. That is to say, each TCP connection occupies 1 KB of system memory.

The maximum number of TCBs in the system is determined by the following registry settings:

[HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ Services \ Tcpip \ Parameters]
MaxFreeTcbs = 2000 (Default = RAM dependent, but usual Pro = 1000, Srv = 2000)

For non-Server versions, the default value of MaxFreeTcbs is 1000 (physical memory larger than 64 MB)

Server version. The default value is 2000.

That is to say, by default, up to 2000 TCP connections can be established and maintained at the same time in the Server version.

Maximum number of TCB Hash tables

TCB is managed by Hash table. The following registry settings determine the size of the Hash table.

HKEY_LOCAL_MACHINE \ System \ CurrentControlSet \ services \ Tcpip \ Parameters]
MaxHashTableSize = 512 (Default = 512, Range = 64-65536)

This value indicates the number of pagepool memory allocated. That is to say, if MaxFreeTcbs = 1000, the size of pagepool memory is kb.

The MaxHashTableSize must be greater than 500. The larger the number, the higher the redundancy of the Hash table, and the smaller the number of TCP connections allocated and queried each time. The value must be a power of 2 and the maximum value is 65536.

 

Typical configuration of IBM WebSphere Voice Server in windows server 2003

This is a typical configuration of IBM WebSphere Voice Server. For more information, see

IBM Web Sphere Voice Server configuration

 

  • MaxUserPort = 65534 (Decimal)
  • MaxHashTableSize = 65536 (Decimal)
  • MaxFreeTcbs = 16000 (Decimal)

Here we can see that MaxHashTableSize is configured to be 4 times larger than MaxFreeTcbs, which can greatly increase the speed of TCP establishment.

 

 

Eaglet other operating system-related articles

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.