1. View the number of concurrent requests for the Web server (Nginx Apache) and its TCP connection status:
netstat -n | awk ‘/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}‘
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 waiting to be processed)
SYN_RECV 30
Established 1597 (normal data transfer status, can be understood as close to the number of concurrent connections)
Fin_wait1 51
Fin_wait2 504
Time_wait 1057 (number of requests processed, waiting for timeout to end)
Additional parameter Description:
closed: No connection is active or in progress
SYN_RECV: A connection request has arrived, wait for confirmation
syn_sent: Application has started, open a connection
FIN_WAIT1: Application says it has completed
itmed_wait: Waits for all groups to die
closing: Both sides simultaneously try to close
time_ Wait: The other side has initialized a release
last_ack: Wait for all groups to die
2. View the number of nginx concurrent processes
ps -ef | grep nginx | wc -l
The number returned is Nginx is not the number of processes, if Apache is executed
ps -ef | grep httpd | wc -l
You can also use the following command:
watch -n 1 -d "pgrep nginx|wc -l"
3. View the number of Web server process connections:
netstat -antp | grep 80 | grep ESTABLISHED -c
4. View the number of MySQL process connections:
ps -axef | grep mysqld -c
(summary) View the concurrent connections and connection status of Nginx Apache MySQL under Linux