In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly analyzes the Linux server CLOSE_WAIT connection too many how to do the relevant knowledge points, the content is detailed and easy to understand, the operation details are reasonable, has a certain reference value. If you are interested, you might as well follow the editor to have a look, and follow the editor to learn more about "what to do if there are too many CLOSE_WAIT connections on the Linux server".
If you execute the following command on a Linux system, you will find that there are a large number of TCP connections in the CLOSE_WAIT state.
Netstat-atn | grep CLOSE_WAIT | wc-l cause analysis
Judge whether the number of CLOSE_WAIT exceeds the normal range according to the traffic volume on the instance. When the TCP connection is disconnected, you need to wave four times. Both ends of the TCP connection can initiate a request to close the connection. If the peer initiates a closed connection, but the connection is not closed locally, the connection will be in the CLOSE_WAIT state. Although the connection is already half-open, it can no longer communicate with the peer, and the connection needs to be released in time. It is recommended to timely determine whether a connection has been closed at the business level, that is, to close the connection in time in the program logic and check it.
Solution method
The corresponding read and write functions in the programming language generally include the TCP connection function to detect the status of CLOSE_WAIT. You can check the number of connections in the CLOSE_WAIT state on the current instance by executing the following command.
Netstat-an | grep CLOSE_WAIT | wc-l
The methods to close connections in Java and C languages are as follows:
Java language
The read method was used to judge the Imax O. When the read method returns-1, the end has been reached.
Close the connection through the close method.
C language
Check the return value of read.
If it is equal to 0, you can close the connection.
If it is less than 0, check error. If it is not AGAIN, you can also close the connection.
About "Linux server CLOSE_WAIT connection too much how to do" introduced here, more related content can search previous articles, hope to help you answer questions, please support the website!
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.