Preface First, let's see how to identify a TCP connection? The system is identified by a four-tuple, (src_ip, src_port, dst_ip, dst_port), namely source IP, source port, destination IP, and destination port. For example, we have a service at 192.168.0.1 with port 80 open. Then all clients will connect to port 80 of this service. There is a misunderstanding that we often say that a machine has 65536 ports, so the number of connections it carries is 65536. This statement is extremely wrong, which confuses the source port and the access target port. When we do stress testing, we use the stress testing client. The number of connections of this client is limited by the number of ports, but the number of connections on the server can reach tens of thousands, generally up to one million (4C8G configuration). As for the upper limit, it depends on the degree of optimization. The specific steps are as follows: We are stress testing a target server and want to see the number of connections under load. When we stress it to a certain number, the console suddenly reports "too many open files". This is because when the Linux system creates a TCP connection, it creates a socket handle, and each socket handle is a file handle. The operating system has a limit on the number of open file handles. One of the basic philosophies of Unix/Linux is "everything is a file". To increase TCP carrying capacity, you need to adjust the file handle. Step 1: Modify the file handle limit # View the maximum number of file handles that the current user is allowed to open with TCP ulimit -n # Modify file handle vim /etc/security/limits.conf *soft nofile 655350 * hard nofile 655350 After the modification, exit the terminal window and log in again (no need to restart the server), and you can see the latest results. This is the first step in optimization, modifying the file handle limit.
Step 2: TCP parameter tuning
From the above configuration parameters, we can know that buffer queues are set up for TCP sending and receiving in the Linux kernel, which can improve the system throughput. All of the above parameters are defined in the /etc/sysctl.conf file. Some parameters may not be defined in the file. The system gives default values. If you need to modify them, add or modify them directly in the file, and then execute the sysctl -p command to make them take effect.
Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. Thank you for your support of 123WORDPRESS.COM. You may also be interested in:
|
<<: Basic usage examples of Vue named slots
>>: 8 ways to manually and automatically backup your MySQL database
Operating system: Ubuntu 17.04 64-bit MySQL versi...
Let me first introduce to you that the node proce...
1. Turn off the firewall and transfer the softwar...
1. The ENV instruction in the Dockerfile is used ...
The previous article introduced how to achieve a ...
This article records the method of sharing files ...
Let's take an example: The code is very simple...
Teaching Topics Web page Applicable grade Second ...
This article uses an example to illustrate the us...
In the front-end layout process, it is relatively...
Table of contents 1. Effect diagram (multiple col...
Table of contents 1. Problem 2. Solution Option 1...
Table of contents Understanding SQL Understanding...
Table of contents 1. Custom routing 2. Tab naviga...
<body> <div id="root"> <...