Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a couple PHP applications running on an Ubuntu 10.04.4 server. One is a custom Yii application and one is PHPMyAdmin. Both applications recently started having very slow load times for seemingly random page or asset loads. After the issue was discovered, the server, PHP, and Apache were updated.

Sometimes the browser won't begin to display new content for several seconds, and then the entire page will load in 100ms. I set execution time echoes in my script and PHP reports that the page execution is 100ms or whatever, but the page takes several seconds before it shows anything in the browser. Other times the page will load most of the way, but will hitch on a JavaScript asset load for several seconds (as reported by Chrome debug window). Other times pages load with no problem whatsoever. Nothing funky appears to be happening when viewing htop during page loads in any of these cases.

httping reports consistent response times around 65-75ms. This is over a LAN. Ping is <1ms consistently.

It seems to me like some sort of an issue with initializing PHP or with Apache handing execution off to PHP. Any suggestions as to what might be going on here or what a good next troubleshooting step would be? Thanks.

Edit: I just got it to hang on one JS file after creating links to 10 JS and 10 CSS files in my a script that just measures execution time, includes the aformentioned JS and CSS files, and runs a simple select query on the MySQL database.

share|improve this question
Instead of measuring exec time inside the scripts, you could add %D to apache LogFormat, so you'll have the time spent in microseconds to serve each http request, including static contents. –  Daniel Vérité Jan 29 '13 at 16:26
Great tip, thank you. –  BStep Feb 14 '13 at 16:19

2 Answers 2

You mentioned phpmyadmin, so I assume there is a MySQL server somewhere in the mix. Is it possible that the database server is slow, and causing the lag?

share|improve this answer
Hmm...I don't think that could account for the slow JS asset loads, for example. The MySQL instance is running on the same server as the webapps, by the way. –  BStep Jan 23 '13 at 21:24
Just in case, I just created a test script that creates a mysql connection and makes a simple query, prints the results, and writes the execution time. Execution time is extremely fast and I'm not seeing the browser hang at all. I also have a <script> tag referencing an external JS file - no hanging on there either. –  BStep Jan 23 '13 at 22:17
I just got it to hang on one JS file after creating links to 10 JS and 10 CSS files in my test script. –  BStep Jan 23 '13 at 22:28

This ended up resolving itself, and I never figured out what the actual issue was. Must have been network or something with the overall environment (maybe the vmware host the VM is on, storage attached, something like that) because I didn't make any changes that suddenly fixed it.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.