Knowledge Base

Troubleshooting TTFB
(time-to-first-byte)

Category: TroubleShooting | Last modified: March 22, 2021

The TTFB (time to first byte) is the length of time a browser needs to wait for a response from the server after making a request, the time needed to prepare and send the requested data. A well performing website has a TTFB at or below 0.50 seconds.

What does it mean if your site has a poor TTFB? It means something on your website, a plugin or function, is taking too much time to process server-side. Identifying and addressing the culprit will have a positive impact on your website’s overall performance!

How to test TTFB

Webpagetest.org
You can submit your website to https://www.webpagetest.org, which will then provide you with a performance overview of your site, including the TTFB.

In your browser’s console

If you are familiar with using Chrome’s console, you can quickly identify the TTFB of your site in the Network tab.  More information about that can be read here.

From the terminal

In Mac and Linux, you can test the TTFB quickly and easily in the Terminal app by entering the following:

curl -H 'Cache-Control: no-cache' -s -o /dev/null -w "Total time: %{time_total} \n" "https://yourdomain.com/"

How Batcache affects TTFB

Batcache stores and serves rendered pages of your site after two subsequent visits to that page within two minutes, and that cached version is saved for five minutes.  This can positively affect TTFB; once a cached version is served, you may notice an improvement in the time to first byte.

If you want to test your page’s TTFB without Batcache, you can add a random query parameter to the URL.  For example: https://yourdomain.com/?nobatcache.  But keep in mind, after you load that URL twice it too will have a cached render saved and you’ll need to change your query parameter again.

You can read more about how Batcache works on Pressable servers here.

How to troubleshoot poor TTFB

Step 1: Clone your website

To prevent disruption to your live website, it’s recommended that the following tests be performed on a clone of your website.  You can follow this guide to create that clone.

Step 2: Switch to a default theme

The next step is to determine if the TTFB is being caused by a function within your theme or not.  Activate one of the included default themes (TwentyNineteen or TwentyTwenty for example) and then test your site’s TTFB again.  If the TTFB remains high, proceed to step 3.

Step 3: Enable/disable plugins one at a time while testing

Before enabling/disabling plugins one at a time, it is recommended to first disable them all and test the TTFB, to verify that the issue is originating from one or more of them.  Once that has been established, you can enable them one at a time while testing, until the culprit is identified.

Next steps

Once you have determined what is affecting your website’s time to first byte, you can then:

  • Check if the plugin or theme has an available update.  Often simply updating can resolve the issue.
  • Decide whether to keep using plugin or theme, or if you’d prefer to find a similar alternative that will not affect your load times as negatively.
  • Contact the developer of the plugin or theme to report the issue.
  • If you found that the TTFB was notably improved when Batcache kicked in, you can optionally choose to extend the length of time Batcache retains a render.
An Automattic Invention A family of WordPress solutions.