1) Use ps to view the number of httpd processes
ps -ef | grep /usr/local/apache2/bin/httpd | wc -l
2) Use ps to view the number of httpd threads
ps -eLf | grep /usr/local/apache2/bin/httpd | wc -l
3) View the number of concurrent requests of Apache and the status of TCP connections
netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
Example of returned result:
TIME_WAIT 927
CLOSE_WAIT 42
FIN_WAIT1 6
FIN_WAIT2 517
ESTABLISHED 634
SYN_RECV 15
• SYN_RECV represents the number of requests waiting to be processed; ESTABLISHED represents the normal data transmission status; TIME_WAIT represents the number of requests that are processed and waiting for the timeout to end.
Status: Description
• CLOSED: No connection is active
• LISTEN: Server is waiting for an incoming call
• SYN_RECV: A connection request has arrived, waiting for confirmation
• SYN_SENT: Application has started, opening a connection
• ESTABLISHED: Normal data transfer status
• FIN_WAIT1: Application says it is done
• FIN_WAIT2: The other side has agreed to release
• ITMED_WAIT: Waiting for all packets to die
• CLOSING: Both sides try to close at the same time
• TIME_WAIT: The other side has initiated a release
• LAST_ACK: Waiting for all packets to die