In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Preface
First, let's take a look at how to identify an TCP connection. The system is identified by a quad, namely source IP, source port, destination IP, and destination port. For example, we have a service of 192.168.0.1, which opens port 80. 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 carried is 65536, which is extremely wrong, which confuses the source port with the access target port. When we do the pressure test, using the pressure test 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 thousands, usually up to one million (4C8G configuration). As for the upper limit, it depends on the degree of optimization. The specific practices are as follows:
We are testing a target server to see the number of connections loaded. When we hit 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 the load of TCP, you need to adjust the file handle.
Step 1: modify the limit on the number of file handles
# View the maximum number of file handles that the current user allows TCP to open ulimit-n # modify the file handle vim / etc/security/limits.conf* soft nofile 655350 * hard nofile 655350
After modification, exit the terminal window, 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.
Note:
Soft nofile (soft limit) means that Linux further limits the number of files that users can open at the same time within the scope of the current system.
Hard nofile (hard limit) is the maximum number of files that the system can open at the same time based on the system's hardware resources (mainly system memory).
Usually the soft limit is less than or equal to the hard limit
Step 2: TCP parameter tuning
Parameter default configuration adjustment configuration indicates the number of file descriptors open by all processes in fs.file-max10485769999999 fs.nr_open16355901635590 the maximum number of files that can be allocated by a single process net.core.rmem_default124928262144 default TCP read buffer net.core.wmem_default124928262144 default TCP send buffer net.core.rmem_max1249288388608 default TCP maximum read buffer net.core.wmem_max1249288388608 default TCP maximum send buffer net.ipv4. Tcp_wmem4096 16384 41943044096 16384 8388608TCP send buffer net.ipv4.tcp_rmem4096 87380 41943044096 87380 8388608TCP read buffer net.ipv4.tcp_mem384657 512877 769314384657 512877 3057792TCP memory size net.core.netdev _ max_backlog10005000 receives packets at each network interface faster than the kernel processes them The maximum number of packets allowed to be sent to the queue net.core.optmem_max2048081920 the maximum buffer size allowed per socket net.core.somaxconn1282048 the maximum listening queue length per port, this is a global parameter net.ipv4.tcp_fin_timeout6030 for local disconnected socket connections, the time TCP remains in the FIN-WAIT-2 state (in seconds). The other party may disconnect or never end the connection or the unexpected process dies net.core.netdev_max_backlog100010000 when the rate of packets received by each network interface is faster than the rate at which the kernel processes these packets, the maximum number of packets allowed to be sent to the queue net.ipv4.tcp_max_syn_backlog10242048 the maximum number of connection requests that have not yet been acknowledged by the other party can be kept in the queue. If the server is often overloaded You can try to increase the maximum number of timewait sockets that this digital net.ipv4.tcp_max_tw_buckets50005000 system can process at the same time whether net.ipv4.tcp_tw_reuse01 allows TIME-WAIT sockets to be reused for new TCP connections net.ipv4.tcp_keepalive_time7200900 indicates how many seconds after the TCP link has no data message transmission starts the probe message (sends an empty message) net.ipv4.tcp_keepalive_intvl7530 represents the previous one The time interval between the probe message and the next probe message net.ipv4.tcp_keepalive_probes93 indicates the number of probes
As we can see from the above configuration parameters, we have buffered queues for both tcp send and receive in the Linux kernel, which can improve the throughput of the system.
The above parameters are defined in the / etc/sysctl.conf file, some parameters may not be defined in the file, the system has given a default value, if you need to modify, directly add or modify in the file, and then execute the sysctl-p command to make it effective.
Note:
Parameter values are not set as large as possible, and some need to consider the hardware configuration of the server, the impact of parameters on other services on the server, and so on.
Summary
The above is the whole content of this article. I hope the content of this article has a certain reference and learning value for everyone's study or work. Thank you for your support.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.