In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article shows you how to improve the load capacity of the Linux system to cope with short connections. The content is concise and easy to understand, which will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
In the case of a large number of short connections, the TCP stack of Linux generally generates a large number of socket in TIME_WAIT state.
You can see this with the following command:
Netstat-ant | grep-I time_wait
Sometimes, this number is staggering:
Netstat-ant | grep-I time_wait | wc-l
It could be more than thirty or forty thousand. At this time, we need to modify the linux kernel tcp time wait time, shorten it, there seems to be a sysctl parameter can be used, it is / proc/sys/net/ipv4/tcp_fin_timeout, the default value is 60, that is, 60 seconds, a lot of online data say that setting this value lower can reduce the TIME_WAIT status in netstat, but this statement is wrong. After carefully reading the kernel source code of Linux, we find that this value is actually used for output, and it is not really read back to the kernel for use after modification, but what really works in the kernel is a macro definition. In $KERNEL/include/net/tcp.h, there is the following line:
# define TCP_TIMEWAIT_LEN (60*HZ)
And this macro really controls the timeout of the TCP TIME_WAIT state. If we want to reduce the number of TIME_WAIT states (thus saving a little bit of kernel operation time), we can set this value lower. According to our test, it is appropriate to set it to 10 seconds, that is, modify the above to:
# define TCP_TIMEWAIT_LEN (10*HZ)
Then recompile the kernel and restart the system to find that the TIME_WAIT state caused by short connections is greatly reduced:
Netstat-ant | grep-I time_wait | wc-l
In general, it can be reduced by at least 2 stroke 3, and it can also improve the speed of the system to deal with short connections.
The above content is how to improve the load capacity of the Linux system to cope with short connections. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.
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.