Re: debugging websites running on Apache?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



----- "Tomasz Chmielewski" <mangoo@xxxxxxxx> wrote:

> How do you debug websites running on Apache?
> 
> Say, you have a website which is dog slow on the powerful server.

If your website is static, and is dog slow although running on
a powerful server, you're doing it wrong.

Check http://wiki.apache.org/httpd/PerformanceScalingUp
 
> My favourite way (after checking the obvious errors from the logs) was
> 
> to simply run Apache through strace, which would print where httpd 
> processes connect to (and possibly hang, while waiting for a 
> connection), what SQL queries they do, what files they try to open, 
> where they write to etc.

If it's dynamic and is dog slow, it's usually because of the
web application (I prefer to call it application, not site in
this case so you can easily distinguish it.)

What you want is a profiler for your environment. With PHP you
have for instance: Xdebug: http://www.xdebug.org/docs/profiler

For mod_perl there's Apache::DProf
http://search.cpan.org/~fwiles/Apache-DB-0.14/ (but I have no
experience with it)

> This is great as it lets you see pretty everything which happens on
> the 
> system, but has one major drawback: if anyone but you is using the 
> webserver, you'll get a lot of noise in strace output - so debugging 
> with strace is really only useful if you're the only user, which
> doesn't 
> make it a great debugging tool on a busy webserver.
> 
> 
> What are other debugging methods which can be used on a busy
> webserver? 
> Ideally, I'd like to see all connections, database queries, files
> opened 
> for read/write by Apache processes, with timestamps, as I connect from
> a 
> given IP address (so all other noise is excluded).

Even with strace you can reduce the amount of syscalls you see.
Check strace(1) for the -e option.

If you're on a modern Operating System, you'll have something like
DTrace or SystemTap in place, which is a big plus, as it ads almost
no overhead to your actions, and could be considered monitoring.

If you're on a DTrace aware platform, there's mod_dtrace!
(I haven't looked into porting mod_dtrace such that it will
work with SystemTap, but it shouldn't be too hard.)

> -- 
> Tomasz Chmielewski
> http://wpkg.org

i

-- 
Igor GaliÄ

Tel: +43 (0) 664 886 22 883
Mail: i.galic@xxxxxxxxxxxxxx
URL: http://brainsware.org/

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx
   "   from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx
For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx




[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux