Posted May 13, 2008
vmstat and tail make a great sandwich
To diagnose a slow web server, interleave vmstat and tail.
Have an inexplicably slow web server? By running vmstat and tailing your web logs at the same time, you can get a good sense of what requests are causing swapping or blocking on i/o or pegging the CPU or whatever:
vmstat -a -Sm 1 & tail -f /var/log/apache2/access.log
procs -----------memory---------- ---swap-- -----io---- -system-- ----cpu---- r b swpd free buff cache si so bi bo in cs us sy id wa 0 0 572 202 7 223 0 0 12 0 17 71 8 0 91 0 1 0 572 202 7 223 0 0 0 0 17 42 1 0 99 0 66.249.66.225 - - [07/May/2008:11:32:14 -0400] "GET /trac/weblion/browser/weblion/Mobilize?rev=3484 HTTP/1.1" 200 3331 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 0 0 572 349 7 223 0 0 0 96 33 116 4 1 94 0 66.249.66.225 - - [07/May/2008:11:32:15 -0400] "GET /trac/weblion/browser/users/ems174/AppleScripts?rev=3521 HTTP/1.1" 200 3225 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 0 0 572 349 7 223 0 0 0 0 8 29 0 0 100 0 66.249.66.225 - - [07/May/2008:11:32:17 -0400] "GET /trac/weblion/browser/weblion/debian/cosign/trunk/Makefile.in?rev=2795 HTTP/1.1" 200 4160 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 0 0 572 349 7 223 0 0 0 0 25 67 2 0 98 0 66.249.66.225 - - [07/May/2008:11:32:18 -0400] "GET /trac/weblion/browser/weblion/SQIConnector?rev=3485 HTTP/1.1" 200 3259 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" 0 0 572 349 7 223 0 0 0 36 37 85 2 0 97 1
The advantage this has over just running top in a separate window is that you can scroll back and reread to discern patterns.
Anybody know a tool that presents this sort of thing graphically? That'd be cool.
Document Actions
Want to comment on this article? Use our feedback form
