Viewing Apache Connection Count on Linux

1. Check Apache current concurrent connections:
  netstat -an | grep ESTABLISHED | wc -l
  Compare with the MaxClients value in httpd.conf to see the difference.
  2. Check number of processes:
  ps aux|grep httpd|wc -l
  3. You can use the following parameters to view data
  server-status?auto
  #ps -ef|grep httpd|wc -l
  1388
  Counts the number of httpd processes. Each request starts one process, applicable to Apache servers.
  Indicates that Apache can handle 1388 concurrent requests; this value can be automatically adjusted by Apache based on load.
  #netstat -nat|grep -i "80"|wc -l
  4341
  netstat -an prints the system’s current network connection status, grep -i "80" extracts connections related to port 80, and wc -l counts the number of connections.
  The final returned number is the total number of all current requests on port 80.
  #netstat -na|grep ESTABLISHED|wc -l
  376
  netstat -an prints the system’s current network connection status, grep ESTABLISHED extracts established connection information, then wc -l does the counting.
  The final returned number is the total number of all current established connections on port 80.
  netstat -nat||grep ESTABLISHED|wc – Can view detailed records of all established connections
  View Apache’s concurrent request count and TCP connection states:
  Linux command:
  netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
  (This command was obtained from Wang, Technical Director of Sina Interactive Community Division. Very useful.) Sample output:
  LAST_ACK 5
  SYN_RECV 30
  ESTABLISHED 1597
  FIN_WAIT1 51
  FIN_WAIT2 504
  TIME_WAIT 1057
  Where:
  SYN_RECV indicates the number of requests waiting to be processed;
  ESTABLISHED indicates normal data transmission state;
  TIME_WAIT indicates requests that have completed processing and are waiting for timeout.
  ———————————————————————————————
  Check httpd process count (i.e., the number of concurrent requests Apache can handle in prefork mode):
  Linux command:
  ps -ef | grep httpd | wc -l
  View Apache’s concurrent request count and TCP connection states:
  Linux command:
  netstat -n | awk '/^tcp/ {++S[$NF]} END {for(a in S) print a, S[a]}'
  Sample output:
  LAST_ACK 5
  SYN_RECV 30
  ESTABLISHED 1597
  FIN_WAIT1 51
  FIN_WAIT2 504
  TIME_WAIT 1057
  Explanation:
  SYN_RECV indicates the number of requests waiting to be processed;
  ESTABLISHED indicates normal data transmission state;
  TIME_WAIT indicates requests that have completed processing and are waiting for timeout.

Leave a Comment

Your email address will not be published.