What is TTFB and its impact on site speed

In general, when we talk about WordPress site speed, we often focus on front-end performance and page load optimization. However, sometimes it is better to look at it from the server where your website originally loads. Today we will look at the impact of TTFB on your website and discuss ways to reduce it. TTFB is often overlooked as an optimization factor, but site speed should be considered when testing.


What is TTFB?

TTFB stands for time to first byte. Simply put, a measure is the amount of time a browser has to wait before receiving the first byte of data from the server. The longer this data is received, the longer it takes for the page to be displayed to the visitor. One common misconception is that TTFB is calculated after a DNS search, however, calculating TTFB on a network always involves network latency. The 3 stages of Process, Delay, and Latency may occur anywhere in between and add to your overall TTFB.

1-Request to server

When someone visits your website, the first thing that happens is to send an HTTP request from the user to the server. At this stage, there are various factors that affect the delay. Slow DNS lookup can increase request time. If the server is geographically far away, the distance the data should travel is effective in latency. Also, if you have complex firewall rules, it may increase routing time. And in addition, do not forget the user’s internet speed.

2-Server processing

After the request is sent, the server must process it and generate a response. This can cause a variety of delays such as slow database retrieval, overly intermediate scripts, failure to cache the first response, improperly optimized code or format, and insufficient server resources such as disk I / O or memory .

3-Reply to user

After the request is processed by the server, it must send it to the user. This step affects both the server network speed and the user’s internet speed. If the user’s internet speed is low, it will affect TTFB.


Is TTFB important?

It is important to know that TTFB and website speed are not the same. There is a lot of debate on the web about whether TTFB is important. Some say TTFB is meaningless and others say it matters. Both groups give reasons for what they say and ask questions about how it is calculated.

Even the Moz website conducted an extensive study on the relationship between search rankings and TTFB. However, knowing why this is the case, or whether sites with lower TTFBs are faster, can in turn be influenced by Google’s page ranking factors.

But instead of spending time on whether or not it matters in SEO, you can focus on improving this important metric. Everything you do can affect the overall speed of your site, whatever your CMS (WordPress, Joomla, etc.), and this may affect your TTFB. In experiments with high TTFBs, the loading speed was very slow.

In general, TTFB is suitable if the loading speed is below 100 milliseconds. Google PageSpeed ​​Insights recommends less than 200 milliseconds for each response. If you are in the range of 300 to 500 milliseconds, it is almost standard. And if you are over 600 milliseconds, there may be a server configuration problem or it may be time to upgrade to better web software. Or you can follow the instructions below to reduce TTFB and keep in mind that SSL / TLS can also be a slow factor.

There are many different ways you can try TTFB. In the following, we will get acquainted with some of them. But remember, each tool gives slightly different results, so it is very important to use only one of them and use it as a basis for other activities.


Measure TTFB with Google Chrome DevTools

TTFB can be measured in Google Chrome using DevTools. Remember, if you use your computer to measure TTFB, TTFB will be affected by network latency and Internet connection. So it is better to use intermediary tools to perform the test from the data center.

  • In the Chrome menu, select More Tools, then select Developer Tools from the Chrome menu.
  • Right-click on an element on the page and select inspect.
  • Use the shortcut keys Ctrl + Shift + l (Windows) or Cmd + Opt + l (Mac)

You can select the network window and see the performance of your site.


Measure TTFB with WebPageTest

You can also test TTFB with WebPageTest. Great time required for DNS, socket and SSL negotiations + 100 milliseconds. One letter A is deducted for every 100 milliseconds. As you can see in the experiment below, the TTFB of this site was calculated in 0.256 seconds or 256 milliseconds.


Measure TTFB with Pingdom

Chrome and WebPageTest refer to Pingdom as TTFB. However, if you are using Pingdom, it actually refers to TTFB as Wait Time. You can use the Pingdom Help for more information.


Measure TTFB with GTmetrix

One of the most popular tools for Iranian administrators who use it the most, Gtmetrix site can also be a very suitable tool for calculating the TTFB of your site, you can check your site using different locations.


Measure TTFB with performance.sucuri

The main difference between performance.sucuri and other tools is that in one test it can test your site from 10 different places around the world and provide TTFB time for each place with an overall average, one of the weaknesses of this tool is caching or better I would say that there is no management ability to test again and if we test the same site again, it will show the previous results.

There are also various other tools for measuring TTFB, such as tools.keycdn.com and ByteCheck. Even Google Analytics has a section for viewing the average response time.


4 ways to reduce TTFB on the site

We now offer solutions to reduce TTFB on the website.

1-Use a high-speed host with optimal configuration

The first way to improve TTFB time is to use a suitable host with optimal settings, because apart from its effect on speeding up the site, it also has a very direct and critical effect on the user experience. Basically, few shared hosts have a suitable TTFB and most of them are not optimally configured. Be.

2-Use the appropriate CDN

Another way to reduce TTFB is to use the Content Delivery Network, or CDN. CDN can be translated into a content distribution network, and we have talked many times about the importance and positive and negative effects of CDNs. If you have a website that hosts users from different parts of the country or the world, using a CDN can drastically reduce your TTFB, but in some places this is not the case, for example in Iran. Read in GTmetrix.

3-Use the right cache on the site

The third and perhaps easiest way to reduce TTFB is to use caching on the WordPress website. Many people think that just using caching can reduce page load time, but in fact it also reduces TTFB and also reduces server processing time. For more information, refer to the article How to cache the site.

4-Use a valid DNS Provider (not free)

DNS is also effective in TTFB. It is very difficult to calculate the exact amount of this effect, but you can still see the total DNS lookup time. There are fast and slow providers. Using the SolveDNS speed test tool, you can perform the necessary tests from different places. To reduce DNS load time, you can read post 8 ways to reduce DNS Lookups and fix Reduce DNS lookups in GTmetrix.

in the end

There are several things you can optimize or fix to reduce TTFB, such as database caching, Disk IO, Swap usage, RAM, PHP settings, MySQL settings, network settings, TLS overhead, and more. But the above are easier to implement and speed up your performance. So the next time someone asks you how to reduce TTFB, keep in mind that WordPress fast hosting, CDN, Caching and DNS are very important in this regard. Fixing and improving these cases is the solution to the TTFB problem.


Leave a Comment