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
When looking at High Performance MySQL Version 3 ...
Linux and Unix are multi-user operating systems, ...
Table of contents mysql master-slave replication ...
I installed IE8 today. When I went to the Microso...
First, you can open Moments and observe several l...
If the field storing the name uses the GBK charac...
Table of contents Listener watch Format Set up th...
Hello everyone, I am Liang Xu. When using Linux, ...
Rancher deployment can have three architectures: ...
We are not discussing PHP, JSP or .NET environmen...
Format Encoding 1. Please set the page width with...
Thanks to the development of the Internet, we can...
I recently helped someone with a project and the ...
Glass Windows What we are going to achieve today ...
A few simple Linux commands let you split and rea...