View the number of concurrent connections in linux.
1. view the number of concurrent requests and TCP connection status of the Web server (Nginx Apache:
Netstat-n | awk '/^ tcp/{++ S [$ NF]} END {for (a in S) print a, S [a]}'
Netstat-n | grep ^ tcp | awk '{print $ NF}' | sort-nr | uniq-c
Or:
Netstat-n | awk '/^ tcp/{++ state [$ NF]} END {for (key in state) print key, "t", state [key]}'
The returned results are generally as follows:
LAST_ACK 5 (number of requests awaiting processing)
SYN_RECV 30
ESTABLISHED 1597 (NORMAL Data Transmission status)
FIN_WAIT1 51
FIN_WAIT2 504
TIME_WAIT 1057 (processed, number of requests waiting for timeout)
Other parameters:
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
2. view the number of processes running Nginx
Ps-ef | grep nginx | wc-l
The returned number is the number of processes running nginx.
Ps-ef | grep httpd | wc-l
3. view the number of Web server process connections:
Netstat-antp | grep 80 | grep ESTABLISHED-c