What is TTFB? Why it is crucial for your website?
Ruby Goyal
Content Marketing Manager - at Embee| B2B Marketing | IT & SaaS Marketing | Digital Marketing | Event Marketing | Social Media Marketing | Branding & Communications | Marketing Strategy | ORM | Email Marketing | Paid Ads
Want to improve your WordPress site load time?
One way is to optimize your webpage to increase the site speed.
But even though you have done all the front-end fixes to increase website speed, you are not getting the desired result.
Maybe because the problem is not with your User Interface instead, it lies with the webserver on which your site is hosted.
Your site’s time to first byte (TTFB) can be the speed killer.
If you are not familiar with this term, then don’t worry. I will be discussing what TTFB is,
how it impacts your website speed, how to measure it, and tips to decrease the TTFB on your WordPress website in this article.
What is TTFB?
TTFB stands for Time to First Byte. It is the amount of time it takes for a page to initiate the loading process. If you land on a web page and get a white screen for a few seconds, that is Time to First Byte (TTFB).
TTFB is the time it takes for a browser to receive its first byte of data from the server. The longer it takes to get that information, the longer it takes to show your web page.
Following are the main 3 components of TTFB:-
1. The time it takes to send the HTTP request
Whenever a user visits your website, an HTTP request is sent from the user’s browser to the server. Now, the time it takes for a server to get the request depends on various factors:-
- DNS Lookup Time
- User’s Internet Speed
- Geographical distance of the server
- Complex Firewall Rules
Slow DNS Lookup time and user’s internet speed can result in a delay in sending the request. If the server is located too far from the user’s location or if you have applied complex firewall rules to your site, then in both the cases TTFB increases.
2. Processing of Request
Once the HTTP request is sent, the server processes the request to generate the response. It depends on the following factors:-
- Database Calls
- Running Scripts
- Ineffective server resources
- Not caching the first response
- Communicating with other systems on the Network
Slow database calls, unwanted scripts, inefficient server resources, and failure to cache the first response can result in higher TTFB.
3. Transfer of a request and response over a network
The time it takes for the server to send back the first byte depends on:-
The network speed of the server- This component accounts for almost 40% of TTFB. If the network speed of the server or user is slow, then the time to first byte increases.
Why optimizing TTFB is Crucial?
TTFB contributes to your overall website speed. It is crucial to know that TTFB is not page speed but instead gives you an idea of the responsiveness of your site.
There are always two sides to a coin. This is also true in the case of TTFB. Some say that TTFB doesn’t affect your search engine rankings while others believe it does.
Moz also did a study on TTFB and found that it is directly related to search engine rank. But whatever the case may be, TTFB can impact the speed of your site, so why not optimize it to make your website faster.
The ultimate goal is to improve the page load time-on-site and enhance the user experience. Someone is less likely to leave a website if the content starts displaying on the page quickly, resulting in higher user engagement and retention.
What is Right TTFB?
- A good TTFB is under 200ms.
- For static sites- TTFB should be under 100ms.
- For dynamic sites (WordPress sites)- 200-500 ms
Have you encountered a situation in which when you click on a button, and you didn’t get a response immediately, you click on it again?
Yes. But what does it do? It disturbs the response you sent the first time.
To avoid this type of situation, Google recommends <50ms time to process user inputs. Hence, a user can get a visible response within 100ms. For inputs that take longer than 50ms to process, you should give feedback, i.e., show a loading indicator or alter the color for the active state.
How to Measure Time To First Byte?
You can check what your TTFB is using GTMetrix tool. In this tool, TTFB is referred to as “Waiting.”
Steps to check the TTFB using GTMetrix are:-
- Go to https://gtmetrix.com/
- Enter your site name and click on Analyze
- GTmetrix gives your webpage a letter grade to show how well it loads.
- Open the waterfall.
- When you hover over the first result in the list, you’ll see your loading metrics, including wait time.
- You can also check the YSlow score, fully loaded time, total page size, and a number of server requests. It allows you to set automatic alerts to get notified when your site begins to load at speed below a specific threshold.
Pingdom also refers to TTFB as “Wait Time” and offers a lot of insight into how to improve your site.
- Steps to check the TTFB using Pingdom are:-
- Go to https://tools.pingdom.com/
- Enter your site name, select your location, and click on Test Site.
- Go to the “File Requests” section
- When you hover over the first result in the list, you’ll see your loading metrics, including wait time.
- It gives you a list of specific fixes to improve TTFB and lets you check your site’s speed in 7 different predefined locations.
You can also use Chrome Dev Tools to measure TTFB. But it has a drawback. If you are testing TTFB using this tool from your computer, the results can be affected by network latency and your internet connection.
So try to use a third-party tool that tests from a data center. Steps to check the TTFB using Chrome Dev Tools are:-
Go to Chrome Menu
- Select More Tools > Developer Tools
- Right-click on a page element
- Choose Inspect
- You can also use the keyboard shortcuts Ctrl+Shift+I (Windows) or Cmd+Opt+I (Mac)
- Open the network window
- Check your website’s performance.
This is another free page speed test tool to check TTFB. WebPage Test allows you to check your website’s loading time from different devices and different server locations.
KeyCDN offers an online Web Performance Test to measure TTFB from 14 different test locations. As shown in the following screenshot, the TTFB for the google.com website is lower in the US and higher in Europe, Asia, and Australia. This shows that distance and latency play a significant role in TTFB.
How to Lower and Optimize TTFB?
1. Use a Fast Web Host
Choosing the right host is very important for TTFB of your webpage. Managed WordPress hosting can prove to help improve TTFB.
The location of your host server also matters. So, you must choose the site of a server that is close to your targeted traffic.
For example, if the majority of your traffic comes from the United States, it would make sense to host your site in the United States, not India. Another factor is the scalability. Your hosting server must be scalable if you’re expecting high traffic to your site to improve its TTFB.
2. Keep WordPress, Plugins, and Themes Up to date
- Updating WordPress theme and plugins can help in reducing TTFB as WordPress keep on adding performance optimizations to its updates.
- Sometimes, they may have optimized the queries that their code runs to the database, or made updates that affect the efficiency of the PHP code.
- Delete unwanted plugins or themes from your WordPress backend.
- Always check the quality of a plugin before activating it on your site.
- An excellent example of this is- Broken Link Checker Plugin. The function of this plugin is to run in the background and check for a broken link. This results in a slow WordPress admin and higher TTFB.
3. Lower the number of Queries
The number of Queries can also have a direct impact on your site’s TTFB.
- You can install the Query Monitor Plugin to find any query bottlenecks.
- New Relic tool can also help in identifying database queries that are taking a very long time to run, so you can find which plugins, themes or settings hurt your site’s page speed.
4. Enable Caching
- Enable Caching on your WordPress site to optimize your TTFB.
- It does so by reducing server processing time.
5. Use a Good Quality CDN
- As discussed above, Network latency can be a potential reason behind high Time to First Byte.
- Using the right CDN can help deliver your static content such as images and scripts, faster to visitors via a network of servers located all over the world.
- Hence, if your server is geographically located in the US, for example, and your users are mostly in India, they will get your site’s content from a server location that’s nearer to them.
- This helps in decreasing the network latency between your website’s server and your users.
6. Choose Managed WordPress Hosting
- Standard hosting packages don’t offer premium DNS but managed WordPress hosts do.
- Managed WordPress Hosting provider will make sure that DNS queries are answered with low latency by using a global network of DNS servers.
- Enable DNS prefetching on your site to inform the browser to perform DNS lookups on a page in the background while the visitor is browsing.
Conclusion
TTFB depends on many other things like PHP setting, MySQL setting, RAM, Cache profiling, TLS, User’s network connection, Browsers, location….
That does not mean you can do nothing, or you should do nothing.
The best solution is to have better hosting. With better hosting comes the better configuration of servers, and better optimization of resources.
Which, in results, improve the Time to First Byte.