Very long time to first byte

One of the things I’ve been noticing about my web site (a wordpress blog) is that there’s a very long lag between the initial DNS lookup and the start of the content download.

Results here:

4772ms in this case! I notice similar results when tracking through pingdom. Yet when I run a tracert on my domain, everything seems pretty speedy.

Does anyone have any idea what’s causing this initial lag? Is this a domain issue? Or are there other technical reasons at play? Thanks!

That’s back-end server processing time (database queries, etc). It shows up a lot with wordpress-based sites. There are some plugins that eliminate it by caching the server-side HTML (in a smart way so it is flushed if the content changes). This is a fairly common one that also automates a bunch of other optimizations:


Wow, thank you! At first glance, that seems to have done the trick:

I’ve been going nuts trying to figure out what was wrong for the past couple months, and thought my host was to blame, but it’s great to know what the problem actually was. Thanks again for your help!

Very nice. If you want to get even faster the plugin should have settings that will enable the combining of some of those css and js files which would shave a few more seconds off but even without it that’s a phenomenal win (one that should be easily visible when browsing the page).

Hmm, I’m not sure if you’d have any insight to this, but any thoughts would be much appreciated.

The cache plugin seems to be working well from an end user standpoint. Site loads quick when I visit with cache/cookies cleared. Test results are quick on webpagetest. Reponse times have dropped significantly when testing via

But strangely response times when testing on pingdom have actually increased significantly from ~2500ms to ~6000ms (averages around 740ms over the past week when checking on And the time spent downloading a page in Google webmaster tools has also increased significantly, from what was around 1,000ms to somewhere in the 2,500-5,000 range over the past week or so.

Do you have any idea why this might be occurring? Thanks a bunch.

Pingdom should be with a “clear cache” as well AFAIK. Have you tried with different browsers to see if there is something that is specific to different user agent strings?

Otherwise it gets more complicated and you have to actually optimize the wordpress site manually (or try a different accelerator plugin).

Start by figuring out what the slower plugins are that you have installed (on a dev siite, disable all of them and check performance - even though the page will probably not be functional and re-enable them in batches). It also means walking through the template php code and figuring out what it is doing. You might also need to instrument and time the database calls in case that is where the slowness is coming from (usually it is the sheer number of them but if each is running slowly you may need to ping your hosting provider).

Yeah, I’ve tried it on different browsers and they all seem to load the cache pages quickly. I was surprised about Pingdom, because I figured it’d be in the same vein as site24x7. Less so about Google, since I knew the W3TC plugin excludes the spider agents. But I think I’ll let it serve cache pages to the spiders for now until I figure out what’s going on.

Heh, I was afraid you’d say that. Do you have any recommendations on tools to use to time the database calls? The only thing I’ve been able to find is a php code that shows the total number of queries and total response time, but I haven’t been able to find something that shows the load time for each individual query.

Thanks again.