As O & M personnel, we often need to check the current concurrency of the Centos server to see if the server has reached the concurrency bottleneck. So how to view it? Use the following command to view various connection statuses in groups. Netstat-n |
As O & M personnel, we often need to check the current concurrency of the Centos server to see if the server has reached the concurrency bottleneck.
So how to view it? Use the following command to view various connection statuses in groups.
|
Netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]}' |
Returned results:
SYN_RECV 2 (two SYN connection requests are received for confirmation)
ESTABLISHED 1 (one normal data transmission status)
TIME_WAIT 62 (62 requests awaiting completion)
Description of all states that can be returned:
CLOSED: No connection is active or in progress
LISTEN: The server is waiting for incoming call
SYN_RECV: a connection request has arrived, waiting for confirmation
SYN_SENT: The application has started. open a connection.
ESTABLISHED: normal data transmission status
FIN_WAIT1: The application says it has been completed
FIN_WAIT2: the other side has agreed to release
ITMED_WAIT: wait until all groups die
CLOSING: both sides attempt to close at the same time
TIME_WAIT: the other side has initialized a release.
LAST_ACK: waiting for all groups to die
If you only want to view normal concurrent connections, run the following command:
|
Netstat-nat | grep ESTABLISHED | wc-l |