What is TTFB? How to Optimize Server Response Time
One of the most problematic aspects of website speed improvements is fixing errors that tell you to reduce time to first byte (TTFB). In this article, I will try to inform you about how to minimize the issue of the TTFB. Besides, I will discuss more about the importance of server & hosting preference for SEO.
What is Time To First Byte (TTFB)?
TTFB is the period measured between the client's (HTTP & HTTPS) requests and the first byte of the website.
Having a good TTFB value is very important for the speed optimization of a website.
What is a Good TTFB Value?
TTFB can vary greatly depending on what type of content (static or dynamic) you share, the configuration of your server, etc. That is why it is difficult to answer the question "what is a good TTFB value?" and it depends on the status of your website.
If you have a TTFB value that is approximately lower than 100 ms, it is a great value. While the values between 200-500 ms are deemed average, the values between 500 ms - 1 s might not be considered ideal at all. In some cases, depending on the type of the website or page, it may be inevitable for the TTFB value to be longer than 1 second.
If you see that error in the Page Speed results, that is because there is a value over 600 ms:
You can check the average server response time through Search Console search statistics:
If you have a shared server or use multiple websites on a single server, the volume in websites may vary depending on other websites in the servers. Surely one must not confuse TTFB with the server response time.
What Slows Down TTFB Value?
Here are the main factors that slow down the TTFB value:
● Badly-configured server structure,
● Server capacity issue (bandwidth or RAM, etc.),
● Dynamically created content,
● Database questions.
How to Measure TTFB?
In Page Speed Insight results, you may come across an error/warning such as “reduce the time to first byte”:
You can run Lighthouse:
You can also measure the TTFB values in Google Chrome Network:
You can also run a TTFB test here: https://gtmetrix.com/.
You can clearly monitor the process via Speed Visualization as well:
In that case, this website https://www.webpagetest.org/ is also helpful for you:
You can also check out the monthly-updated website: https://ismyhostfastyet.com/. Based on the data from Chrome UX, the following table provides details, including their TTFB values and how many websites they have:
How to Optimize Time to First Byte (TTFB)?
There are several ways of optimizing the TTFB value. By suggesting many of them, I should warn you about the situations in which you might need to work hard with the hosting company or software team.
Cache
There are a lot of interactions and processes required to create a page, and as a result of this, the TTFB value can be affected since each interaction takes some time. You can copy these processes beforehand with the help of cache integrations and save time from loading times.
If you have a website such as Wordpress, you can use extensions such as W3 Total Cache or LS Cache.
HTTP/2 Usage
Googlebot generally crawls on HTTP/1. However, from November 2020, Search Console started to send message to website owners if they are able to use HTTP/2, it is stated that your website can be crawled on this version:
You can detect the sources using HTTP/2 with Chrome:
CDN Usage
You can optimize the TTFB values by using CDN. If you have a website with intense traffic, CDN might be a perfect solution for the sources to load faster.
Database Optimization
Of course, this section will be elaborated on by the members of the back-end team. Additional modules to websites, old user databases, or several queries can cause a bigger burden on databases. That is why it would be better to optimize databases as well.
If you use Cpanel, you can see the disused databases and database users and remove some of them if suitable:
Example Mysql users:
If you use Wordpress, with the help of PhpMyAdmin, you can check the tables left from the older extensions. Thus, you can reduce the database load caused by the disused extensions:
For instance, I can see the vacant table structures with the order below:
select table_schema as database_name,
table_name
from information_schema. tables
where table_type = 'BASE TABLE'
and table_rows = 0
and table_schema not in ('information_schema', 'sys',
'Performance_schema', 'mysql')
-- and table_schema = 'sakila' -- put your database name here
order by table_schema,
table_name;
When I start running the SQL, it shows me the results:
SQL results may differ from website to website. In these examples, you can see more or fewer table structures. Before getting to these steps, please do not forget to backup your data:
Extensions such as WP Speed of Light and WP website owners can arrange the DB-related operations even faster. Surely you can use other extensions or you can continue these processes without any extensions:
And if you have a website with a PHP infrastructure, you had better upgrade it to the latest version:
How to Choose the Best Server?
I would like to elaborate on how you can choose the most suitable server in terms of SEO.
Bandwidth
One of the most important points while choosing hosting is the monthly bandwidth. Do not forget to keep this domain under control in services such as the purchased server, hosting, or VPS. Due to instant trend traffic at an unexpected time, you can run out of bandwidth:
You can analyze the last 24 hours or the last week:
You can also assess how much bandwidth you use for which month. If you have a website with low traffic, you may not prefer a wide bandwidth. Instead, you can get a more suitable server for your website and fulfill your server need at lower costs:
If your bandwidth does not meet the traffic your website receives, server errors may be multiplied and your website may become "suspended":
Taking all of these points into consideration, you can buy hosting from the domestic market or foreign markets by deciding on the packages suitable for your website:
If you use shared hosting, you most probably will be subject to certain limits even though it is stated that you have limitless bandwidth. That is why you should always know the CPU limits in hosting packages and communicate with your server manager on how hard you can push these limits. We do not come across this problem in packages such as VPS/Dedicated Servers/ (depending upon the hosting firm for sure) however, still consider asking:
Googlebot may also slow down the searching speed if the server bandwidth is low. Furthermore, in server changes, the searching speed may be readjusted by Googlebot because it will try to understand what the gap is between the new server and the old one:
You can also create your server with hardware features such as SSD disk. Besides, RAM size and processor features are among the key elements. A server with a faster processor can lead several operations to run more quickly:
The reason why I elaborate on hosting that much intensely is that Google also made announcements about it:
Lite Speed Usage
You can have a faster performance by installing LiteSpeed on your servers. LiteSpeed with a paid license offers better results compared to its competitors.
You can find an example for LiteSpeed installed on Cpanel in the image below. You can make all of the settings on this screen and if needed, you can restart LiteSpeed Web Server:
While deciding on a server, you make sure LiteSpeed is included:
Reducing the HTTP Requests
First of all, make sure that you remove Yandex Metrica or similar codes that you do not use or rarely use once in a year from the source code. In this way, you can make some great benefits by deleting the codes barely working for you. Fewer HTTP requests will lead to faster upload times.
If there are third-party files and several CSS & JS files on your site, these ones will create some additional requests. The more HTTP requests a browser creates, the longer it takes for your page to upload.
You can check the number of requests via Chrome, for instance, there are 179 requests for the homepage of ZEO:
You can also check out the detailed outlook of the requests via GTmetrix:
To optimize the number of requests, remove, integrate or minimize the unnecessary JS, CSS files. You may plan to use image elements together or, if there are unnecessary ones, reduce their number and minimize them as much as possible.
To Sum Up
If you would like to learn more about the TTFB metric, you can also check the topics such as DNS lookup, Premium DNS, SSL negotiation, and Initial connection.
Finally, I would like to remind you again that if you optimize the TTFB alone, it will not be enough to completely speed up your website. This metric stands only for a single metric of speed improvements.
Useful Resources: