How to Reduce Time to First Byte and Load Your WordPress Site Faster

If your WordPress site is still loading slowly even after you’ve implemented front-end performance fixes, it’s time to take a look at your backend. Specifically, your site’s time to first byte (TTFB).

TTFB refers to the amount of time it takes a browser to create a connection to the server and start downloading the contents of a web page.

In this post, we’re going to explore TTFB and what it is, what causes a slow TTFB, what Google recommends, and how to reduce it to make your pages load faster.

What is TTFB?

Google defines TTFB as a period of “waiting”:

“Time spent waiting for the initial response, also known as the Time To First Byte. This time captures the latency of a round trip to the server in addition to the time spent waiting for the server to deliver the response.”

To put it simply, TTFB is the amount of time from the moment you navigate to a web page to the moment it starts rendering.
TTFB is made up of three separate components:

1. The time it takes to send the HTTP request

TTFB starts with the request. The time it takes for a server to receive the request depends on the time it takes to perform a DNS lookup, the speed of the user’s network, the distance to the server, and any interruptions in the connection.

2. The time it takes to process the request

Once the server receives the request, it has to process it and generate a response. This involves starting processes, making database calls, running scripts, and communicating with other systems on the network.

3. The time it takes for the server to send back the first byte of the response to the browser

Finally, the server needs to send the response to the user. This step is dependent on both the network speed of the server and the user. If the user has a slow wifi connection, it’s going to affect the TTFB. Transmitting a request and response over a network can account for almost 40% of TTFB.

Basically, the longer it takes to send a request to the server, process it, and send it back to the user’s browser, the longer it takes to display your page to the user.

Why is TTFB Important?

TTFB is a factor that contributes to your overall page speed, so it’s an important metric to keep an eye on and optimize. It’s also worth pointing out that you shouldn’t confuse TTFB with page speed—it’s simply a metric that gives you an idea of the responsiveness of your site.

But is TTFB important? The jury’s still out on that question. While Google web performance engineer Ilya Grigorik says TTFB “absolutely does” matter, Cloudflare says you should stop worrying about TTFB.

Interestingly, Moz did a big study of TTFB and found a clear correlation between a faster TTFB and a higher search engine rank. While the link between the two couldn’t be proven outright, the authors of the study determined there was enough of a correlation to at least warrant further discussion of the topic.

I’d encourage you to read up on both sides of the argument, and also take a look at Moz’s research. But whatever the case may be, TTFB is still a metric that’s (mostly) within your control that you can tweak to speed up your site. So why not reduce it to make your site faster?

Ultimately, the important thing is that you consider your users. Because when you reduce TTFB:

  • Users spend less time waiting for your site to start loading, improving the user experience.
  • Users are less likely to bounce while waiting for content to start appearing on the page, meaning higher engagement and retention.

What is a Good TTFB?

Google recommends a TTFB under 200ms.

rackAID, meanwhile, digs into the numbers further, suggesting a TTFB under 100ms for static sites with HTML, images, CSS, and JavaScript. And for dynamic sites (such as WordPress sites), a TTFB around 200-500ms.

The TTFB for dynamic sites takes into account what’s happening behind the scenes of your WordPress site. For instance, when a request is made, PHP scripts have to call a number of included files, made a connection to the database, parse the results, and send back the final HTML page.

If your TTFB is more than a few hundred milliseconds, there might be some bottlenecks on your server that you need to investigate.

Earlier in the year, we looked at the RAIL Performance model, which takes into account response times.  If you’ve ever clicked on something and it took so long to respond that you started wondering whether it registered your click, so you clicked a second time, but in doing so you interrupted the response to your first click… Well, this is exactly the kind of thing RAIL aims to avoid.

Google recommends that sites should process user actions/inputs within 50ms to ensure a visible response within 100ms. For actions that take longer than 50ms to complete, always provide feedback, i.e. display a loading indicator or change the color for the active state.

What Causes a Slow TTFB?

When it comes to WordPress sites, there are several different factors that can affect TTFB:

  • Network latency
  • High web traffic
  • Server configuration and performance
  • Dynamic content
  • DNS response time

There isn’t much you can do to solve high web traffic or network issues. But there are ways you can address server configuration, dynamic content, and DNS response times, which we’ll explore below.

How to Measure TTFB

The first step to uncovering why your TTFB is time is high is to measure it. There are several ways you can measure TTFB, but keep in mind that each of the tools below will output different TTFB so I recommend using the tool you’re more familiar and comfortable with.

Measuring TTFB with GTmetrix

You can easily measure TTFB with GTMetrix, which refers to this metric as “waiting” time.
To see your results, scan your site and open the waterfall. When you hover over the first result in the list you’ll see your loading metrics, including wait time (aka TTFB).

Measuring TTFB with GTmetrix

Measuring TTFB with WebPageTest

You can also measure your TTFB with WebPageTest. When you scan your site, the results will display a letter grade for your TTFB and also display your TTFB in seconds.

Measuring TTFB with WebPageTest
Measuring TTFB with Pingdom

Pingdom also measures TTFB, referring to it as “wait” time. To use this tool, simply scan your site and scroll down the results to the “File Requests” section where you’ll see wait times for your site and individual requests.

Measuring TTFB with Pingdom

Measuring TTFB with KeyCDN’s Web Performance Tool

Another fantastic tool for measuring TTFB is KeyCDN’s online Web Performance Test. It lets you quickly measure your TTFB from 14 different test locations. As you can see in the results below, the TTFB for the WordPress.org site is lower in the United States and higher in Europe, Asia and Australia—proof that distance and latency play a big role in TTFB.

Measuring TTFB with KeyCDN’s Web Performance Tool

How to Reduce TTFB

Let’s look at some ways you can reduce the TTFB for your WordPress site.

1. Use a Fast Web Host

Using a fast web host that has a carefully thought out architecture will go a long way to reducing your TTFB. Managed WordPress hosts configure their servers specifically for WordPress sites, so you can be confident your dynamic content is in good hands.

It’s crucial that you consider where your host’s servers are located. Choose a host that is located physically closer to where your users are. For example, if most of your users are located in Europe, it would make sense to host your site in Europe, not in the United States. (Although you can get around this with a CDN, which we’ll look at below.)

Also, while you can’t really control the amount of traffic your site receives, you can control your site’s scalability. So if you’re expecting high traffic to your site, ensure your host is able to scale your site quickly to improve its TTFB.

2. Keep WordPress, Plugins and Themes Updated

The WordPress core team, along with plugin and theme authors, often adds performance optimizations to their updates. Sometimes, this means they have optimized the queries that their code runs to the database, or made updates that affect the efficiency of the PHP code.

It’s best practice to only keep the plugins and themes you need and delete the rest. So regularly review your plugins and themes, and remove any that you’re no longer using.

The quality of your plugins can also impact your TTFB, so look out for plugins that are impacting your site’s performance. Broken Link Checker, for example, is designed to run in the background, checking for broken links every so often. The result is a slow WordPress admin and increased TTFB.

3. Reduce Queries

Often, the number of queries your site is running to get information from the database can affect TTFB. To help identify any query bottlenecks, try installing a diagnostic plugin like Query Monitor, or consider a more heavy duty tool like New Relic. The latter will help you really dig into database queries that are the most time consuming or have the slowest query time so you can find which plugins, themes or settings are affecting your site’s page speed.

4. Use Caching

One of the easiest ways to decrease TTFB is to set up caching on your WordPress site. Caching helps decrease TTFB by helping reduce the server processing time.

Check with your web host to see what they offer as far as object caching does. Often, all you need to do is ask your host to enable it.

Also, enable WP Rocket on your site to cache dynamic content so your pages are delivered faster to returning site visitors.

5. Use a CDN

Using a good quality CDN can help deliver your static content, like images and scripts, faster to users via a network of servers worldwide. This means that if your server is geographically located in Europe, for example, and your users are mostly in the United States, they will receive your site’s content from a server location that’s closer to them.
This reduces the network latency between your site’s server and your visitors.

For more on CDNs and how to choose the find one, check out The Best Content Delivery Networks for WordPress.

6. Use a Premium DNS Service

Typical hosting packages don’t offer premium DNS (although, some managed WordPress hosts do). Investing in a premium DNS provider will ensure DNS queries are answered with low latency by using a global network of DNS servers, in turn helping to reduce your TTFB.

If you want to take this a step further, consider enabling DNS prefetching on your site. This technique lets you tell the browser to perform DNS lookups on a page in the background while the user is browsing. For more on this, check out Preload, Prefetch, Preconnect: How to Speed Up Your Site With Browser Resource Hints.

Wrapping Up

There are loads of other advanced techniques you could implement on your site to improve your TTFB, such as Disk IO, TLS overhead, reducing autoloaded data, and more. But the methods we’ve covered in this article are relatively easy to implement and will give you the biggest bang for your buck.

While the jury’s still out on whether TTFB is a meaningful metric, it’s still worth doing what you can to measure and improve your TTFB. Ultimately, the faster you can start displaying content to your visitors, the more likely they will stick around, browse your site, and convert.

About

Raelene Morey is the Co-Founder of Words By Birds, a digital writing agency that helps busy WordPress with writing articles, content strategies, lead magnets and other word-related things. A former journalist and editor, Raelene has been developing WordPress sites for over 10 years.

0 comments

Comment

Leave a Reply

Your email address will not be published. Required fields are indicated by *