My apache2 is using running slowly. A single PHP file is takes long time to process. The server is live. I dont want to restart it. So I thought I attach strace
to it and check whats happening.
So I run
strace -p `cat /var/run/apache2.pid `
After that I load some testing urls. Load then many times. But I didn't see any output at the strace
console!
Then I remember there are many child processes. So I checked them
$ ps ax | grep apache[2] -i
1877 ? Ss 0:02 /usr/sbin/apache2 -k start
2006 ? S 0:00 /usr/sbin/apache2 -k start
2007 ? S 0:00 /usr/sbin/apache2 -k start
2008 ? S 0:00 /usr/sbin/apache2 -k start
2009 ? S 0:00 /usr/sbin/apache2 -k start
2010 ? S 0:00 /usr/sbin/apache2 -k start
9985 ? S 0:00 /usr/sbin/apache2 -k start
9988 ? S 0:00 /usr/sbin/apache2 -k start
9997 ? S 0:00 /usr/sbin/apache2 -k start
9998 ? S 0:00 /usr/sbin/apache2 -k start
9999 ? S 0:00 /usr/sbin/apache2 -k start
Now my question is how do I strace all of these child processes? How do I know which child process is handling the request right now?