I have installed the apachelog program on my ubuntu system. I have several virtual hosts that point to the same log file, so when I run the following, I should see all requests from the multiple sites:
$ apachetop -T 300 -f /var/log/apache2/other_vhosts_access.log
That should show all requests coming in starting now for the next 5 minutes. So I test it with multiple sites, and indeed it reports them:
last hit: 20:56:14 atop runtime: 0 days, 00:02:50 20:56:24
All: 10 reqs ( 0.1/sec) 7443.0B ( 103.4B/sec) 744.3B/req
2xx: 3 (30.0%) 3xx: 7 (70.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
R (170s): 10 reqs ( 0.1/sec) 7443.0B ( 43.8B/sec) 744.3B/req
2xx: 3 (30.0%) 3xx: 7 (70.0%) 4xx: 0 ( 0.0%) 5xx: 0 ( 0.0%)
REQS REQ/S KB KB/S URL
3 0.04 6.0 0.1*/
2 0.03 0.2 0.0 *
1 0.01 0.2 0.0 /wp-includes/js/comment-reply.js
1 0.01 0.2 0.0 /wp-content/themes/gd-theme/scripts/cycle.js
1 0.01 0.2 0.0 /wp-content/themes/gd-theme/scripts/api.js
1 0.01 0.2 0.0 /wp-includes/js/jquery/jquery.js
1 0.06 0.2 0.0 /users/sign_in
One was from a wordpress site and another from ruby on rails site. Apache says there were 7 requests coming in. Maybe there were 7 http requests coming in (I highly doubt it because that ruby on rails site has several js and images to load), but actually there were only 2 tcp connections made and only two apache child processes should have been spawned, since I am using KeepAlive. Something definitely doesn't seem right with the output it is showing.
What may I be missing here?
apachetop
parses the access log of Apache.Each requests gets individually written to this log regardless of whether it was requested in a single KeepAlive session or multiple TCP sessions.
apachetop
cannot know anything about how many TCP connections have been made.That access log also does not contain any information about Apache childs/threads, so it also cannot report those.
All it shows you is how many resources have been requested.
Many browsers will open up multiple connections to load resources like javascript. I see four of the requests are for java script. These connection may be closed quickly.