How to get “requests per second” for Apache in Linux?

前端 未结 9 685
情书的邮戳
情书的邮戳 2021-01-30 17:53

In Windows for ASP, you can get it perfmon, but...

How to get \"requests per second\" for Apache in Linux?

9条回答
  •  野的像风
    2021-01-30 18:44

    To sum up, you can use mod_status and apachetop.

    Alternatively, you can use Adam Franco's and Jon Daniel's nice scripts to have a live look.

    If you would like to have a look at a partiular date and hour, you can issue this little command:

    grep "29/Oct/2014:12" /var/log/apache2/example.com.log | cut -d[ -f2 | cut -d] -f1 | awk -F: '{print $2":"$3}' | sort -nk1 -nk2 | uniq -c | awk '{ if ($1 > 10) print $0}'
    

    Replace with the date and hour you are interested and also with the proper pathfilename of the log file.

    It will print out something like:

    1913 12:47
     226 12:48
     554 12:49
     918 12:50
    

    There is a nice article here with more options on using a combination of awk, cut and uniq commands to get quick stats of the kind.

提交回复
热议问题