The speed of a webpage is one of the many ranking factors that Google uses to move a webpage to the first page of the Search Engine Result Page (SERP).
With this, you should know that anything you do to improve the speed of your webpage is worth it, and it will, in turn, improve your SEO.
A webpage’s speed can be measured using different web metrics, each metric measuring different aspects of the webpage and also giving you a sense of how fast your users see your webpage to be.
Among the various metrics for measuring the speed of a web page, for this article, we will be focusing on the Time To First Byte. You can browse through our blog to get more information about the other metrics.
What is the Time To First Byte (TTFB)?
The Time To First Byte is a web metric that measures the responsiveness of a web server and how long it takes to set up a connection.
“Time to First Byte is how long it takes for a browser to receive the first byte of information from the server when the browser requests it.”
This time measured encompasses the use of TCP and SSL handshake to establish connections and also include Domain Name System (DNS) lookup.
TTFB is also called “waiting”, I.e. the time spent waiting on the server to send an initial (first) response to the request made by a browser.
The Time To First Byte metric sums up the following request phases:
- Connection and TLS negotiation.
- DNS lookup.
- Redirect time.
- Service worker startup time and so on.
It adds up time spent in making any request, up until the point at which the first byte of the response arrives.
According to the definition of TTFB, it can be seen that it can be broken down into three processes which are:
1. Request made to the server:
When a user opens a webpage or clicks on a link to access a website, the very first thing that happens is that the user’s browser makes a request for the server to send the webpage’s information that the user wants to see.
That was precisely what happened immediately after you clicked on the link to open this page. But this request process can be affected by slow DSN lookup to fetch all the DNS records for a domain, increasing the TTFB metric score.
The request is propagated through the network to the server, and the time taken for this to happen is measured and added to the time spent on the other two processes explained below.
2. Processing of requests:
Once the first process of sending a request to the server is concluded, the server begins to process the request sent to it and, in the end, provide what is requested.
How long it takes the server to process the requests depends on various factors, which may include:
- The type of database calls used.
- Not caching the previous response made by the server.
- The number of plugins and complicated themes used.
- Having too many third-party scripts.
- Inefficient server resources and so on.
After the server has completely processed the requests made by the browser, it generates a response, and the subsequent process begins.
3. Response from the server to the browser:
The response generated by the server is sent to the user’s browser through the network, and the user can then view the content on that webpage. But for TTFB, it only measures the time taken for the server to send the first byte to the browser and not the entire content.
This process is majorly affected by the network speed of the user and also the server. The faster the network speed, the quicker the time to move the server’s response down to the browser.
So with all this explained, let me now give you precisely what the Time To First Byte metric measures.
Time To First Byte measures the time taken for a browser to send a request to the server as a result of the user clicking or interacting with the page, the time taken for the server to process the requests made by the browser and generate a response, and the time taken for the server to send down the first byte to the browser.
The time spent on each process is summed up to give the Time To First Byte (TTFB) score.
Differences between TTFB and FCP.
Time To First Byte (TTFB) and First Contentful Paint (FCP) are both metrics for measuring the speed of a webpage and are pretty similar except for the fact that they measure different aspects of the webpage.
First Contentful Paint measures the time to when the browser renders the first piece of content in the DOM, which is a non-white canvas, providing feedback to the user that the page is loading but Time To First Byte measures how long it takes for a browser to receive the first byte of information from the server after the browser has made the request for it.
Now here is the significant difference between these two metrics; First Contentful Paint measure the time taken for the browser to receive the first piece of content as a response from the server giving a user the sense that the page’s content is loading while the Time To First Byte measures the time taken for the browser to receive the first byte of information as a response from the server.
The first piece of content used in measuring the FCP is visible content, and that is why it is able to give a user that sense that the page is loading, but when it comes to the first byte of information used in getting the Time To First Byte, it could either be a byte of visible information or not.
What is a good TTFB score?
How do I know when I have a good TTFB score?
The Time To First Byte score of your webpage depends majorly on one thing, and that is the network speed which cannot be the same at all times. Network issues can come up, and this will affect the TTFB score.
Due to this effect, fixing an arbitrary number as a good TTFB score is not possible, but it is recommended that you make sure that your server can respond to requests quick enough that you have a good FCP score which is below 1.8 seconds.
Since TTFB precedes FCP, then having a good FCP score will keep your TTFB score in a good range, but in most cases, a Time To First Byte score below 200ms is considered to be a good score, and you can work towards this.
Now you know what a good TTFB score is, how then do you get to know the Time To First Byte score of your webpage?
How to Measure the Time To First Byte.
Time To First Byte is a metric that can be measured in the Lab using Lab tools and in the Field using field tools. You can choose to use any of the Field tools or the Lab tools to measure the Time To First Byte of your site.
1. Lab Tools:
Lab tools simulate a page to load in a consistent and controlled environment. Some of the lab tools used in measuring TTFB include:
2. Field Tools:
Field tools make use of real user experience in measuring different metrics. It shows you exactly what a user experiences when using your webpage.
Field tools used for measuring Time To First Byte include:
Another tool that can be used to measure the Time To First Byte of a site is Google Chrome DevTools, but you need to know that your network condition will affect the result of the test because it is not a controlled environment.
The result you get might not be the same as what your user actually experiences when using your site but using Chrome DevTool gives you an idea of how long the time to the first byte of your site is.
You can make use of Google Chrome DevTools directly from your chrome browser on your desktop by taking the following steps:
- Open the site you want to test on your browser.
- Click on the menu (three vertical dots). It is in the right-hand corner of the screen.
- Click on More Tools, then Developer Tools.
Following these steps above will open the Chrome DevTool, and from there, you can access the Network tab, then the Waterfall column, which contains a list. Go through the list and select that item you want to inspect, and you will find Waiting (TTFB) with the score beside it.
Now that you know how the Time To First Byte is measured, let’s talk about how we can improve the Time To First Byte metric score.
How to improve the Time To First Byte score.
Just as I have explained earlier, Time To First Byte is a metric that measures the time taken for a request made to the server to be completely processed and the first byte of responses from the server sent to the browser.
So improving the Time To First Byte score means cutting down the time taken for these three processes to be completed. But it is important for you to know that some of the causes of a high TTFB score (like network issues) are beyond your control, but you still have some best practices to improve the TTFB score, and these include:
1. Good Web Hosting:
The web host used for a webpage has a lot to do with the speed of the page. Most hosting packages place every user on one server, and when the traffic from each user rises, the server becomes slow, and this affects the website of all the users of that very web hosting package and causes a high Time To First Byte score.
To avoid this, you have to make sure that the web host you are using is a good one with high quality. Make sure you are well informed about the web hosting provider before making any payment for it.
2. Update your Plugins and Themes:
The plugins and themes used in a webpage can also affect the TTFB score of the page because they increase the request sent to the server.
When these plugins or themes and old, they become slow and increase the TTFB score. Though there is a possibility that this isn’t the cause of your high TTFB score, updating the plugins on a page will improve the TTFB score.
Also, try making use of the default theme for your website, as making use of another theme means the browser has to make a request for the theme, and most of the time, it takes longer than the default theme. You also need to reduce the number of plugins you make use of.
3. Make use of a Content Delivery Network (CDN):
A Content Delivery Network is a global or geographically distributed network of proxy servers that serves as an intermediary between a request to the server made by a user and the server proving a response to the request made.
Using a CDN make it possible for the user browser to receive a response from the server fast because they are getting the content from a server that is close to them.
4. Use a Cache:
A cache is a software component that has the ability to store data so that when a browser request is made in the future for such data, it will be served faster.
Making use of a Cache helps to minimise the time spent on server processing and deliver content more quickly, and this will reduce the Time To First Byte score.
All you have to do is check if your web host has this feature, and then you enable it. If you have any problem with this, you can ask your web host to enable it for you.
The Time To First Byte of a webpage has its way of affecting the user experience of such page because when the score is high (I.e. the TTFB score is above 200ms), a user will have to wait a while before the browser receives the first byte and the first piece of content.
The longer a user has to wait, the high the possibility of the user getting frustrated and leaving the page, and this is the reason why Google uses Time To First Byte as a ranking factor to favour sites with lower TTFB scores and give users a good experience.