Our website is deployed on the Linux server, especially the Web server, we may sometimes as operations personnel, must be to see whether the number of concurrent connections to the site is not a bottleneck, so under Linux, how can we see the number of concurrent connections to the server? Use the following commands to view the various connection statuses in groups:
Netstat-n | awk '/^tcp/{++s[$NF]} END {for (a in S) print A, s[a]} '
Explanation: Return Results Example: Last_ack 5 (number of requests waiting to be processed) SYN_RECV established 1597 (normal data transfer status) fin_wait1 Fin_wait2 504 time_wait 1057 ( The number of requests that have been processed, waiting for the timeout to expire) Status: Description CLOSED: No connection is active or in progress LISTEN: The server is waiting to enter the call SYN_RECV: A connection request has arrived, wait for confirmation Syn_sent: The app has started, open a connection Established: Normal data transfer status FIN_WAIT1: The app says it's done Fin_wait2: the other side has agreed to release itmed_wait: Wait for all the packets to die CLOSING: Both sides simultaneously try to close time_ Wait: The other side has initialized a release last_ack: Wait for all packets to die
Using this command, you can view the server's connection status, where established is the number of concurrent connection status displays. If you don't want to see so many connected states, and just want to see the number of concurrent connections, you can simplify the command, namely:
Netstat-nat|grep established|wc-l
1164
The number returned is the current number of concurrent connections.
Linux using the netstat command to view the number of concurrent connections [go]