Amazing 8.8 s time to first byte with WordPress

Hello,

I have an amazing 8.8 s time to first byte… and I have no idea where it comes from…
http://www.webpagetest.org/result/111025_SC_1ZVDN/

I can only tell you that it doesn’t come from our server as the home page of the website which is not using WordPress has a normal time to first byte of 250 ms:
http://www.webpagetest.org/result/111025_9Z_1ZVH3/

Sometimes the time to first byte is lower (the lowest i’ve seen is about 2 to 3 seconds)…

Do you have an idea where to look ? I’ve read that i could come from the database when number of post are big but i’m only to 250 kB of posts… and no temporary version posts.

Any ideas where to look ?
Thanks a lot

Ahh, wordpress and first byte times - quite a recurring theme.

Almost all wordpress first byte problems come from database calls (and it doesn’t necessarily matter the number of posts). Each and every plugin you install can make several database calls for every page load so make sure to disable any plugins that you don’t really need.

Once you are down to the minimal plugins you need you will need to figure out which database queries are causing the problem. You can either look at the MySQL slow query logs or use a WP plugin that logs the database calls. Once you know what the slow calls are you can add indexes to the database to help them (assuming the database itself isn’t just performing horribly).

You can also mostly hide the problem my using a caching plugin (W3 Total Cache or SuperCache are popular ones). They will cache the database calls and generated HTML pages so that when a non-logged-in user visits they can be served a page without having to make any database calls.

Sometimes it can also be caused by plugins that are making back-end calls out to other services but those are less common.

Hello,

9 sec for a slow database is a bit too slow…
I found what was the problem. It was a call to a skype server (that was randomly slow) to check online/offline status and that was causing the “amazing” delay…

so as you said a “back-end calls out to other services” :slight_smile:

I have still a bad time to first byte now but it’s maximum 1 sec so it’s more “normal” hehehe

Thanks for your help!

Glad to help (and glad you tracked it down quickly).

9 seconds for a single database call is insane but you’d be surprised how many WP sites make HUNDREDS of database calls for a single page load because just about every plugin in the gallery is installed.