Research on the concurrent connection number of single machine

Source: Internet
Author: User

The system uniquely identifies a TCP connection using a 44-tuple: {Local IP, local port,remote ip,remote port}.

 client each time a TCP connection request is initiated, unless the port is bound, the system usually picks up an idle local port, which is exclusive and cannot be shared with other TCP connections. The data type of the TCP port is unsigned short, so the maximum number of local ports is only 65536, Port 0 has a special meaning, can not be used, so that the available ports up to 65535, so in the case of all as the client side, the maximum number of TCP connections is 65535, These connections can be connected to different server IPs. The  server is usually fixed on a local port for listening, waiting for client connection requests. Regardless of address reuse (Unix's so_reuseaddr option), the local listener port is exclusive even if there are multiple IPs on the server side, so only the remote IP (that is, the client IP) and the remote in the server-side TCP connection 4-tuple Port (client port) is mutable, so the maximum TCP connection is the client IP number x client port number, to IPV4, regardless of the IP address classification and other factors, the maximum number of TCP connections is about 2 32 (IP number) x2 16 (port number), That is, the server-side stand-alone maximum number of TCP connections is about 2 48-time side.   The main factors that limit the number of connections under Unix/linux are memory and the number of file descriptors allowed (each TCP connection consumes a certain amount of memory, each socket is a file descriptor), and a port below 1024 is usually a reserved port. On the server side, the maximum number of concurrent TCP connections over 100,000 is no problem by increasing the memory and modifying the maximum number of file descriptors.   NOTE: 1. The default Conntrack_max value is no less than 1282. For systems with more than 1G of memory, Conntrack_ The default value for Max is limited to 65536 (but can be manually set to a larger value) 3. The default Hashsize value is not less than 164. For systems with more than 1G of memory, the default value of Hashsize is limited to 8192 (but can be manually set to a larger value)   Summary 1. Each connection consumes a certain amount of resources, such as CPU, MEM, so the real value is often difficult to reach the theoretical value; 2. Depending on the protocol, the maximum number of connections that can be reached is different, such as http/1.0 connection creation and shutdown are very fast, and the browser has a limit on the number of concurrent connections, so, It is difficult to reach the maximum theoretical value. http/1.1 supports streamline technology, and multiple requests can reuse a single connection, which greatly reduces the number of concurrent connections. FTP or Telnet connection is a long connection, veryMaximum value is easily reached. 3. Many devices (such as NetScaler) support the connection pool (connection multiplexing) on the server side, the connection is a long connection, like the http/1.1 inside the streamline technology, a connection can handle multiple client connections. This in addition to reducing the connection resources, but also reduce the load balancer other resource costs, while reducing the network bandwidth. 4. Some devices (such as NetScaler's tcp-offload) support TCP Offload, simply send the established connection to the server side, while TCP's three-time handshake completely has a load balancer takeover, so that the server side of the connection is reduced exponentially.   Data Sources:1.http://wanshi.iteye.com/blog/12562822.http://hi.baidu.com/hawk418/blog/item/8377b86e8fe7b3c081cb4a84.html

3.http://itfun.blog.sohu.com/212057666.html

Single-Machine Millions concurrent connection actual combat

Http://www.2cto.com/kf/201508/437814.html

Research on the concurrent connection number of single machine

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.