Finding Problematic Code with Top and Mod Status

The first step to fixing a problem is figuring out that there is one. Top is great command to examine what’s going on your system. It can tell you how resource intensive a process is, how long it’s been running, who executed it, and etc. Through Top, you can see if a process like httpd or Apache is taking up a lot of resources, if it is then a script executed via Apache is taking up a lot of resources. The problem with Top is that it doesn’t show you what script were executed via the web and how resource intensive that script is, and it’s not supposed to. Just like Windows’ task manager, it doesn’t make any sense for it to keep track of what files are opened in Excel, that’s Excel’s job.

Good thing for us, Apache is able to keep track of it through an Apache Module known as “mod_status”. Today’s post won’t cover how to install mod_status, what its graph looks like, or how to read it, but it’ll talk about how to use it in conjunction with Top to troubleshoot problematic scripts. This information is readily available on the web, but here’s a link to more info regarding the Apache module: http://httpd.apache.org/docs/2.0/mod/mod_status.html

Top allows us to identify which process is sucking up a lot of resources. Mod status keeps track of web calls and their corresponding PIDs. By look up a problem process in top and then finding that process in mod status, then we can start analyzing and fixing the problem. From that point on, we can start the “blaming” process 😉

Leave a comment

Your email address will not be published.