Forum Moderators: phranque
When I visit my website the browser sometimes says "Contacting" for several seconds, then "Waiting" for another second or two, then "Loading." I put in some code to time the PHP parsing, and even after all these seconds of waiting it says the PHP only took a few hundredths or thousands of a second.
It's not my connection or computer, because I have used webperf and other tools and they all agree that my site can take anywhere from 2-30 seconds to load. My page is only about 5 kb in size. It has calls to a database in order to retrieve information, but the PHP timer I put in suggests that this is not the problem.
The strange thing is that once I visit one page on the site (usually takes ~5 seconds to load), all the others I subsequently click on load almost instantly. It doesn't matter which page I start with, it always takes several seconds, so it's not some bad code on a certain page that could be causing this. Then if I leave my site and come back in a minute or two it again takes a long time to load the initial page.
I've watched my traffic drop over 50% since this began, as most of my visitors don't wait for my site to load. I'm guessing that they assume it's down.
My host has been excellent on all counts up until this point, but right now they seem unable to figure out what the problem is.
Also, have you tried a traceroute? Is there something in the along the way that holding things up?
And then, I've seen certain settings at the local level that will cause a site to load a little slowly. Firewall, NIS, etc.
What about external file references like CSS and/or JavaScript. Any issues there that might be holding things up? Have you validated your CSS file?
Is there a possible looping issue somewhere in a rewrite? Is one of the http requests getting hung up on something?
There are so many things that could affect site load times. Do a search in Google for "Web Page Analyzer". I use it all the time to see where bottlenecks are on pages. Great little tool.
The strange thing is that once I visit one page on the site (usually takes ~5 seconds to load), all the others I subsequently click on load almost instantly.
After re-reading your original post, I'd guess that there is an external call that is holding things up. Once that call is made, and the file is cached at your local level, that would be one reason why you are able to browse the rest of the site quickly.