Sommaire

Time To First Byte (TTFB): what is it?

Time To First Byte (TTFB): what is it?

Time To First Byte (TTFB) expresses in milliseconds the response time of a server. It is taken into account by  Google’s Core Web Vitals  and other search engines to evaluate the speed at which content is available in order to allow its display on a web page. So, as you will have understood, it is an indicator that is as important for your loading speed as for your SEO.

A metric that measures what you don’t see yet

When a user visits your website, the browser requests information from a server (origin, remote server, CDN, etc.) which sends it to display the elements that must appear on the page. This time required for the server to send the first byte to the browser is represented by the Time To First Byte (TTFB) – not to be confused with the Start Render or the  First Contentful Paint  , which indicates the moment when the first element of content is displayed on a page.

In other words, TTFB indicates the responsiveness of the server to handle an HTTP request, which takes place in several steps, including network latency:

  • establishing network connection,
  • secure connection negotiation (TLS),
  • sending the HTTP request,
  • sending the first byte of the page.

The faster this process is with , the sooner the browser is informed that the server is up and will send a response. Otherwise, the browser will wait for a response until a  timeout  set by the browser.

If the page cannot be retrieved, here are some examples of errors that may be generated: 

  • 401 – Unauthorized: The page is password protected
  • 403 – Forbidden: The server received the request but refuses to process it (for example, because the password is incorrect)
  • 404 – Not found: the page cannot be found, either because there is an error in the URL or because the page does not exist
  • 500 – Internal error: the server has encountered a problem
  • 503 – Service unavailable: the service is temporarily unavailable (this can be encountered in the event of a peak load)

 

Why is Time To First Byte important?

IT HELPS TO DETECT APPLICATION SLOWNESS (DATABASE, SEARCH ENGINE, MICROSERVICES, etc.)

Server response time is directly related to the speed at which data is retrieved by the browser. Also, if the server response time is high, the fluidity of the site is affected, the browsing experience is degraded, your Internet users are frustrated by having to wait for the page to load and end up leaving it if this delay is too long – at best without having read or bought anything, at worst to go to a competitor.

IT IS RELATED TO SEO PERFORMANCE 

Server response time is an important criterion for your SEO. Indeed, in addition to the page loading time, the faster your server responds, the easier Google robots can  crawl  pages. While we cannot affirm the link between webperf and  SEO ranking  , we observe a correlation between the speed of a site and the number of pages  crawled,  as evidenced for example by  Rue Du Commerce . Google also recommends not to exceed 200 ms of Time To First Byte. 

How to analyze Time To First Byte?

This metric depends on the server capabilities and the internet connection. For one-time monitoring, we recommend using WebPageTest. For daily monitoring, we recommend Pingdom which allows you to check response times anywhere in the world by sending “pings” at regular intervals.

How do you situate yourself?

Google Lighthouse  considers a Time To First Byte (TTFB) to be abnormally high from 600 ms but… considers a TTFB to be good below 200 ms. It should ideally be below 100 ms.

That said, these metrics should be considered in relation to what you are measuring. For a page, having a good Time To First Byte (TTFB) is important for perceived speed. For an individual resource, it all depends on the criticality of the resource in question – it is less of a priority to reduce Time To First Byte (TTFB) for resources with a low criticality level.

If you are a third-party script editor, work tirelessly on your Time To First Byte (TTFB) because your script impacts the loading time of many websites!

What degrades TTFB?

DYNAMIC CONTENT 

Although it is essential, one of the worst enemies of Time To First Byte (TTFB) is dynamic content (custom content inserted by the server, database queries, server queries to third-party services, etc.)! Why? Because the main problem with dynamic content is that the more there is, the more it has to be retrieved from databases and/or by addressing third-party services. Multiplying these data requests slows down server response times; each step adds milliseconds to your loading times.

Additionally, generating web pages with a lot of data requires computation on the server’s part, which also slows down page loading.

TRAFFIC PEAKS

Traffic spikes can saturate your server and cause an increase in Time To First Byte (TTFB). Variations in this indicator can also alert you to potential load problems. Practical advice: in the event of a load spike, be sure to set up an overflow page to preserve the browsing experience (our engine automates this good practice which reassures the customer).

THE CALL FOR APIs

Calling APIs can also degrade Time To First Byte (TTFB), especially when dealing with large volumes of data. 

CONFIGURING YOUR SERVER 

Your server configuration can affect Time To First Byte (TTFB). The more parameters and conditions you have to consider, the more time your server will need to perform calculations. For example, processing database queries for end-user formatting can slow down page loading. 

How to improve your TTFB?

OPTIMIZE YOUR SERVER CONFIGURATION

Depending on how your application server is configured, you can improve your Time To First Byte (TTFB). As we’ve seen, the fewer calculations the server has to perform, the faster it can send a response to the browser. So, to preserve your server response time, keep it simple.

HIDE THE DATA

At the HTTP or application level, caching content saves your server time. It saves on requests to retrieve data since it can access pre-built elements via the cache more quickly. It then has a ready-to-use HTML file for the browser more quickly. 

CONSIDER THE ADVANTAGES BUT ALSO THE LIMITATIONS OF  LAZYLOADING

To send information to the browser as quickly as possible, use the  lazyloading technique intelligently . It can be useful for pages that contain a lot of dynamic content, otherwise this content would be included in the HTML page, which would have an impact on the Time To First Byte (TTFB).
However,  lazyloading  can be counterproductive if it is applied to too many elements of the page, because it would not bring much compared to a page without  lazyloading  which would take a long time to load.

COMPRESS, BUT WITH MEASURMENT

The more you compress your data, the less time it takes to travel from your server to the browser; thanks to the Gzip or Brotli format, you reduce the size of the files which thus travel lighter. However, you must deal with one parameter: the time and CPU power required for compression. Indeed, as long as the file is not completely compressed, no bytes are sent to the browser, and your Time To First Byte (TTFB) is therefore pushed back.
Thus, a high compression level allows the page to be served more quickly to the Internet user, but the server response time can be negatively impacted. And  vice versa , you can have a very fast server response time but data that needs a lot of time to be displayed. It is therefore necessary to find the balance between all the parameters.

Generally speaking, as with a successful cooking recipe, the effectiveness of webperf optimizations depends on a clever mix of different ingredients. Each action taken in one direction can have effects on other indicators, which is why optimizations must be intelligently linked to each other to be effective.

To learn more about how the Fasterize engine works, and how our features work together to improve your web performance:

Summary
Share!
Recevoir la newsletter

Published by

Partagez !

Discover other articles…

But stay informed!

Register!

Every month, no more, receive:

🆕 The latest publications on our blog: platform developments, new features, events, technical advice, analyses…

💡 A selection of monitoring articles: technical news, tips, tutorials, and other findings on web performance…