How can I track down CPU intensive requests in mod

2019-02-14 01:52发布

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?

3条回答
孤傲高冷的网名
2楼-- · 2019-02-14 02:37

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.

查看更多
Animai°情兽
3楼-- · 2019-02-14 02:45

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 ;-)

查看更多
男人必须洒脱
4楼-- · 2019-02-14 02:47

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.

查看更多
登录 后发表回答