How to Speed Up Time to First Byte (TTFB)

Those who are concerned about web front-end performance will encounter the problem of Time to First Byte (TTFB) long waiting time when optimizing web performance. For WordPress sites that are not optimized, TTFB time often exceeds the download time of the page content, bringing unnecessary waiting time for users. The main reason for this problem is on the server side, for those who are not familiar with the server operation and maintenance may not know where to start, today we will analyze the various aspects of TTFB causes and solutions.

What is Time to First Byte (TTFB)

TTFB stands for Time to First Byte, which refers to the time when the browser starts to receive the response data from the server (background processing time + redirection time), and is an important indicator of the server’s response speed. For example, if you ask your friend a question, the shorter the time your friend thinks, the smarter your friend is or the more familiar he is with your problem. For the server, the shorter the TTFB time, the faster the server response.

How long is TTFB time considered long?

Because each server’s hardware and network environment are different, the TTFB time of each server is also different. If you want to know how far your server can be optimized, you can upload some static HTML pages to the server, and then open these static pages to see the TTFB time of some of these pages, most servers have a TTFB time of less than 50 ms, this time is the time we can pursue optimization. The TTFB times in the following two figures are the TTFB waiting times of static and dynamic pages on the server where this site is hosted.

READ ALSO:   How To Fix Error 1020 On Your Website ? 4 Solutions To Fix Error 1020

Static Webpage Waiting Time (TTFB)

Speed Up TTFB

Dynamic Webpage Waiting Time (TTFB)

Speed Up TTFB

According to our tests, if the TTFB time exceeds 500 ms, users will feel a significant wait when opening the web page. We can consider 500 ms is the benchmark.

Reasons for long TTFB

As we know, for dynamic web pages, when the server receives a request from a user to open a page, it first reads the data needed for the page from the database, then passes the data into the template, which is rendered and then returned to the user. Since it takes some time to query the data and render the template, the browser is consistently in a state of waiting to receive a response from the server until this process is completed. Some services have lower performance or are not well optimized, and this time will be longer.

Of course, if the network between the server and the user is not good, (for example, if the server is in Europe and the user is in Asia, when the user opens the page, the request needs to cross thousands of miles to reach the server), the server takes too long to receive the user’s request, which is also the reason for the long TTFB time.

Sometimes, the page saves too many cookies in the user’s browser, and each time a request is made, these cookies have to be sent to the server, and the server has to process them, which is also one of the reasons for the long TTFB time.

The solution for long TTFB

Once you know the cause, the solution is obvious, and that is to shorten the server response time. When a web page is loaded, it is equivalent to downloading the static page directly from the server.

READ ALSO:   10 best M4A to MP3 converter in 2022 (Easy to Use)

If the cause of such issue is network, changing a server is a more direct solution. If for some reason you cannot change the server, you can use a CDN to synchronize the pages to a CDN node closer to the user, which is also a good solution.

If the cause is cookies, you can delete some unnecessary cookies by modifying the application, or streamline the content of cookies, shorten the validity period of cookies, etc.,

How To Contact Facebook? 6 Urls To Solve Your Facebook Issues
What Are The Best Fonts For Your Resume