Update: some "3rd base" debugging tips;
A fairly brutal way to get some debugging is to strace the running apache process, and this is actually easier because the processes are going to be hung for a while.
This command below will only work as stated if your apache is in prefork mode, but I would assume that it would work vaguely similar in worker mode. (but you would have to spend some time getting a ps
and grep
to find the thread ids...) anyway I think php requires prefork...
First check that the server is in prefork mode...
root@server-72839:/home/ubuntu# apachectl -V | grep MPM
Server MPM: Prefork <----------- prefork mode works with php
-D APACHE_MPM_DIR="server/mpm/prefork"
install strace
root@server-72839:/home/ubuntu# apt-get install strace
make some request to the server, and then run the following command to trace the syscalls made by the hung process;
root@server-72839:~# netstat -antp | grep "ESTABLISHED" | grep 80 | while read _ _ _ _ client _ proc; do strace -f -p ${proc#/*} & done
root@server-72839:~# Process 21570 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
chdir("/") = 0
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fabb16b0000
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fabb16ae000
let the page request run through on a windoze box that is slow and then paste all that output back into a pastebin and put the link in a comment.
If you don't have any joy with this, then turn on debugging of php, and httpd Loglevel to debug and paste all that into a pastebin and provide the link....
Edit: (ok maybe not definitely) possibly a reverse DNS problem on the apache server. try the following....
make sure you have set HostnameLookups Off
on your apache server.
http://httpd.apache.org/docs/2.2/mod/core.html#hostnamelookups
Also check that your resolv.conf is specifying working nameservers;
[root@workstation001 /root]# cat /etc/resolv.conf
....
nameserver 192.168.1.254 <---- this must work. test it with dig
test nameserver with dig;
[root@workstation001 /root]# dig @192.168.1.254 www.google.co.uk +short
www-cctld.l.google.com.
173.194.67.94
make the nameserver work, by changing it to 8.8.8.8 (google public dns server)
/etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.8.4
Start by checking out the php.log and apache logs files for the connections which are slow, the problem is likely right there in logs.
However if you are sure that this is not a DNS problem (which you can check using the nslookup command line tool) and there is nothing obvious server side then I would then use google chrome in-built developer tools to see the timeline of the page load.
This will tell you which item in the page is taking so long, and whether the delay is during the connection, or during resource loading etc.
You can move on to tools like wget, curl in cygwin, or plain telnet to further investigate from the client side.
