We want to know how many concurrent users the apache is serving at one time? Can I do it by installing some statistics tools? I tried webalizer but it only shows hourly hits, not the number of users. Or I have to analyze the log using some tools?

  • Apache Module mod_status would be the standard tool I think – ollybee Jan 17 '12 at 20:58

You may want to check out Apache Top.

Or you can write your own script from the command line that just check the number of current connections on the port Apache is running on (usually 80), for example:

netstat -plan | grep :80

Or, if you just want the number:

netstat -plan | grep :80 | wc -l

This could ideally be done through a cron (e.g., run every minute and check number of connections, average over time, etc.).

| improve this answer | |
  • I think the "grep :80" is not working as expected, more if you have services like tomcat or couchbase which run on ports "80XX"... – Frederic Yesid Peña Sánchez Dec 15 '14 at 16:52

Here is a small script that I use. I have an SSL based site, so I'm checking the active connections on port 443. You might want to update 443 to 80, depending on what you would like to monitor.


[ $# -eq 0 ] && { echo "Usage: $0 <refresh time>" ; exit 1; }

while true
        echo "Number of Active Connections:";
        netstat -an | grep 443 | grep tcp | grep -v | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | uniq | wc -l;
        echo "Current Active IP's:";
        netstat -an | grep 443 | grep tcp | grep -v | grep -v ::: | cut -d':' -f2 | cut -d' ' -f12 | sort | uniq;
        sleep $1;

One thing to keep in mind is that, if you're behind a VIP, then your web server will only see 1 IP (the one from the VIP). Since this script is checking for unique IP's, it will always show 1 connection. One way to resolve this is to remove the text "| uniq".

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy