6 ways to reduce Time to First Byte (TTFB)

Do you want to improve your user satisfaction and boost your Google page rankings? You’ve come to the right place. A better user experience starts with your website’s time to first byte (TTFB).  We’ve got 6 actionable tips to help you measure and improve your time to first byte (TTFB).

What is Time to First Byte (TTFB)

When you click on a link or type a URL in the address bar, the clock starts ticking down the amount of time it takes between the initial request until the browser receives the very first byte of data—a.k.a. time to first byte. TTFB is an important measurement of the server’s responsiveness and network latency.

Why you should care about time to first byte?

You may be thinking, “Meh, I have other more important metrics to worry about than time to first byte.” We don’t want to diminish the importance of the other metrics, but TTFB sets the stage for every other metric that follows. Making sure your TTFB is as fast as possible is crucial to providing a performant site or service.

TTFB matters for search engine optimization (SEO)

It isn’t only your user that notices a slow server response, but the search engines watch your TTFB as well. Search engines use several factors to determine where your site falls in the list of search results. Content is still king, but the user experience comes into play as well. Google considers the server response time when evaluating your entire user experience. Your TTFB is the first telltale sign of whether or not things are going to go well.

Oh, did we mention that Google bases your page’s performance on the mobile experience and not the desktop speed? Yes, you heard it right, Google measures your mobile experience to determine if you will give your users a satisfying experience. So, your site has to be fast on what is typically the slowest network connections. Not only is the connection typically slower, but your site has to be fast on a device with a fraction of the computing power of a desktop computer. If your site is fast on mobile, it will be fast on a desktop machine.

Improve user engagement

There is a direct correlation between performance and user engagement. Although time to first byte doesn’t directly influence the user engagement, a slow time to first byte is a good indicator of good things to come, or not.   If a user clicks your link and has to stare at a blank page, after a couple seconds, they bounce. The faster that the page begins to render, the more likely the user is to stick around, which means higher conversion rates, lower bounce rates, and fewer abandoned carts. The TTFB is just the beginning of the total load time, and if the TTFB takes half a second, that only leaves about 1.5 seconds to get everything downloaded and rendered on the browser.

How fast is fast enough for time to first byte?

According to Google Insights, a good TTFB is under 200ms, but other players in the web performance sector suggest a max of 100ms. That isn’t much time considering all that has to happen during the 200ms such as the DNS resolve, routing, connecting, building out the response, and sending the response back.

How do I improve my TTFB?

Your TTFB is primarily a backend function, so most of your adjustments happen on your servers but not exclusively. We’ve put together six tips to help you reduce your TTFB and make sure it stays fast.

Tip 1: Reduce latency

Latency is a killer for website speed. The user’s distance from the server and the quality of the connection impacts the time to first byte. Although you don’t have much control over your user’s connection type and speed (but you can adjust your response based on connection type), you can reduce the load on your servers by using CDNs (content delivery networks).

A CDN isn’t going to do anything for your time to first byte because the first connection is to the web server and not a CDN. However, a CDN puts static resources closer to your users, indirectly making your page load times better. By shifting requests for static page elements to a CDN, you help reduce server load and in turn speed up your TTFB.

Tip 2: Faster DNS resolve

The DNS (Domain Name Service) resolve is the browsers very first task when you request a web asset. The browser starts a whole series of request to turn the web address (e.g., https://www.google.com) into an IP address (e.g., 172.217.168.196). A DNS resolve takes time, but it shouldn’t take more than a millisecond or so.

If you’re experiencing slower resolve times, you may need to look at your DNS settings or consider changing your DNS provider.

Tip 3: Upgrade your web hosting

If your TTFB is over 200ms, your web hosting company may be to blame. Overworked servers and congested networks could translate to a slow user experience. Your time to first byte is the first to suffer. Talk to your hosting service about an upgrade to your service or consider moving your site to a different provider.

Shared web hosting

Shared web hosting is the least expensive way to go when selecting a web host provider, but it comes at a cost. Performance is just one of those costs. If other sites utilizing the same servers become bandwidth hogs, your own site may suffer. You can’t control what other sites you share a service with, and the network and processing power these other sites take may zap all of your resources. So, if you can afford it, and your TTFB is suffering, you may want to consider a virtual private server, cloud hosting, or the ultimate, dedicated hosting.

Virtual Private Servers

With a virtual private server, you get a virtual server independent of other sites. The separation makes the service more scalable and flexible than the shared hosting. With a virtual private server, the configuration of one site doesn’t affect other sites operating on the same physical server.

Cloud hosting

Similar to a virtual private server, a cloud hosting provider distributes your site across many servers making them more scalable and reliable, especially for sudden spikes in traffic.

Dedicated hosting

Dedicated hosting is exactly what it sounds like. You get a physical server for yourself and nobody else. Dedicated hosting is great but very expensive and more difficult to maintain. The advantage is that you control everything about the server including software and hardware, and other sites operating on the same machine do not impact your performance.

Tip 4: Improve the backend performance

We’ve all experienced slow computers, and we’ve all seen how old network hardware such as database servers degrade performance. However, even new servers can be slow if not optimized. Databases especially can drag down your response time if not properly indexed and normalized.

Database normalization

A non-normalized database may contain redundant data increasing its overall size and performance. On the flipside of a normalized database, a properly non-normalized database can combine data frequently asked for together in tables eliminating the time required for complex joins and calculations.

Database indexing

You need to index your database for faster queries. Indexing tells the database where to find columns in the tables, preventing the database from having to examine every column looking for the correct one. If your database queries take too long, check for proper indexing.

Tip 5: Server-side caching

Even for dynamic pages, portions of the page are fairly static. Having the static items readily available on the server helps you keep your time to first byte at a minimum. With server-side caching, you can reduce database queries and processor load by keeping frequently needed data and files ready to go in the server’s cache.

Tip 6: Setup external monitoring to let you know if your TTFB is slipping

Once you have your time to first byte optimized, you need to make sure it stays that way. Changes in hardware, software updates, and site updates can quickly cause your TTFB to climb. If you’re not paying attention to your TTFB, you may not notice an increase in your TTFB until it is too late. However, you’ll notice when your site drops in the search engine rankings and your revenue suffers.

Uptrends Full Page Check Website Performance Monitoring can help you keep track of your site’s TTFB. The green line in the chart below shows the time to first byte for 24-hours. The other lines (except for the pink) show values that contribute to the TTFB including the resolve, wait, and the connection time. The wait time is the largest contributor to the time to first byte due to network latency, but the backend processes may also contribute to the TTFB.

Graph: Time to first byte

Digging a bit deeper, we can see below in our Real User Monitoring reports that the TTFB spiked for the same page at the same time in the chart below. The slowdown in the backend duration increased the wait time leading to a longer TTFB.

RUM backend duration

Takeaways

  • Your time to first byte is important for SEO and user engagement.
  • Latency is a factor in your TTFB increasing wait times.
  • Your DNS provider can affect your TTFB.
  • Your web hosting service and the type of hosting affects TTFB. Upgrading can improve your TTFB scores.
  • Backend performance affects wait times. Optimizing servers and databases caching can reduce backend process times.
  • Server-side caching, even for small page elements, reduces backend duration.
  • Server and site changes impact performance, your TTFB is a great indicator of trouble. By proactively monitoring your TTFB, you can respond quickly to issues.

Uptrends can help you track your TTFB plus all of the other metrics you need to stay on top of. Try Uptrends free for 30-days free to keep track of your site’s uptime and performance.