views:

75

answers:

3

Using Apache 2.2 and mod_perl on Ubuntu 8.04 I have several applications on a server. Using Apache in pre-forking mode. Usually things are working well but once in a while I see one of Apache processes using 100% of the CPU.

There are several web sites on the server with their own VirtualHosts and there are is and SVN server running via Apache.

How could I track down which application and which calls in that application generate the high load?

+2  A: 

Devel::NYTProf is pretty much the premier profiler for Perl right now, with Devel::NYTProf::Apache for easily profiling mod_perl applications.

See Tim Bunce: NYTProf v2 – A major advance in perl profilers for a pretty overview with pictures.

Unfortunately, Devel::NYTProf isn't pre-packaged in Ubuntu Hardy. (It is pre-packaged in Jaunty, Karmic, Lucid, and later.) You can either use some apt trickery to install packages from those distributions, install from CPAN, or just upgrade ;-)

ephemient
once I know which request(s) cause the problem I can try to profile them but adding the profiler to all the requests sounds like a bad idea - at least on first sight
szabgab
A: 

If you have a large subversion repository and path-based authorization enabled in your apache configuration you're going to see some long-running, high CPU apache tasks. You'll probably also have complaints from subversion users about slow commits and updates, along with 503 errors and subversion complaining about truncated SSL responses. If this is the case, I'd make subversion my prime suspect.

converter42
A: 

Use a custom log format or a write a PerlLogHandler that records the request information along with the PID and resource use information. See, for instance, Randal's Web Techniques Column 48.

brian d foy