HOW TO OPTIMIZE TIME TO FIRST BYTE (TTFB)

In the last post we talked about Time To First Byte (TTFB), that is to say the parameter used to measure the web server’s reactivity. In a few words, TTFB is the time between a HTTP client request and the receipt of the first web page byte.

It is a critical dimension for any website because it affects ranking and user experience, so it is very important to make the TTFB value the lowest possible. In today’s article we will talk about that, and we will give you some advices to help optimize your Time To First Byte. In the following lines you will find some tips to speed up web server and get a better TTFB value.

6 ways to improve TTFB:

1. Use a Content Delivery Network
Content Delivery Network (CDN) is a geographically distributed network of servers that allows users to download data from the websites they are visiting using the closest network node. This way the website will be faster both in download and page load and user experience improved. The use of a CDN is not needed for all kinds of websites, therefore is useful to understand if make sense using that service or not.

2. Optimize the application code
The application code is a crucial part in the website’s optimization. Several actions help speeding up the TTFB as regards application code: add a load balancer and cache static and dynamic content, update the software installed on the web server, use a Reverse Proxy Server to accelerate the applications and secure them. In addition, compress data and implement the HTTP/2, as well as monitoring of web server performance and live activities to identify the possible bottlenecks.

3. Optimize the database queries
To optimize database queries first of all you need to create indexes properly and only retrieve the data you really need. Besides, avoid to use functions on the left hand-side of the operator, so you don’t need to read the entire database to answer the query. Avoid also correlated subqueries, because they depend on other queries and slow down the process.

4. Reduce HTTP requests
To reduce HTTP requests you need to check how many requests your website currently makes and remove unnecessary images. Once you made that, you can proceed by reducing the file size of remaining images and analyzing which factors could affect the load speed. Other things you can do to optimize TTFB are make JavaScript asynchronous and combine CSS files together.

5. Ensure a faster server response time
Even here it is important to intervene on CSS and JavaScript files and combine the external ones. In some cases you can use small inline CSS and JavaScript files, putting them in the HTML file itself, so you son’t need external resources and no additional calls would be required for them. It’s also important deferring images, because that helps to save bandwidth and reduce page load time.

6. Use Respond First, Process Later (RFPL) cache
With this cache method the user sees previously cached response at immediately and in the same time, the server still processes the request in the background. This way users are not kept waiting for the response.

Do you want to improve the Time To First Byte? Reserve now a free consulting!

 
Facebook
Twitter
LinkedIn

Contact us

Fill out the form and one of our experts will contact you within 24 hours: we look forward to meeting you!

Richiedi la tua prova gratuita

Ehi! Stai già andando via?

Iscriviti alla nostra newsletter per restare aggiornato sulle novità dell’universo Criticalcase