In this article we will learn to analyze the loading speed of a website and how to improve the page load time of our webpages.
Web Performance Optimization refers to the different techniques designed to improve the loading speed of a webpage. How? By optimizing resources so that they are less heavy and thus improve navigation.
Why is page load speed so important ?
- Fewer people will visit a website that is 250 milliseconds slower than your competitor’s.
- Users are willing to wait for a video to play, but not for a search result.
- 40% of users abandon a page that takes more than 3 seconds to load.
- For Amazon, a 0.1 second delay means a loss of $ 1.6 trillion.
Page load time assessment
This test should be done both on desktop and mobile, as well as in different subpages of the website. It’s common for page load time to vary depending on the individual page because different resources are used.
If we get a low score, we will analyze the contents of the page to assess what is adding time to the webpage load process.
TTFB (Time to first byte)
The TTFB metric measures the time it takes for a browser to receive the first byte of a response from a web server.
There are three fundamental factors that influence TTFB:
- The time it takes to broadcast the request over the network to the web server.
- The time it takes for the web server to process the request and generate a response.
- The time it takes for the server to propagate that response across the network to the browser .
It is recommended that the time of the first byte does not exceed 500 milliseconds**. In fact, the studies by Moz indicate that the pages that are positioned at the top of the SERP ranking have a TTFB of less than 300 ms.
If our server hosting is geographically far from our target market (from where I am receiving the most requests), this may be affecting the latency of the data / information that has to travel from my server to the browser. Another factor may be DNS lookup times.
A recommended solution is the use of CDNs (Content Delivery Networks) which allow users to receive content or information from a server closer to their geographical area.
Number and size of HTTP requests to the server
How can I reduce the number of http requests?
Image optimization has a direct impact on load speed, being able to reduce the download size of a page by up to 75%.
Regarding the optimal weight of the images, it is recommended that they do not exceed 300kb or 500kb in exceptional cases. Most webpage test tools include a module that analyzes the images on a webpage and their degree of optimization
Some recommendations for an adequate image optimization are:
- Adjust the size of each image to their final actual size and thus avoid the browser having to resize the image.
- Simplify the color palette of secondary images.
- Use the JPG format that is compatible with all browsers. Newer formats to test include WebP and AVIF, but use them with a JPG fallback image.
- Optimize images through tools such as TinyJPG or ShortImage.
Browser cache for static resources
The first time you visit a web page, the browser has to download all the resources, and of course, it takes some time. However, the next times you visit the same web page, the browser cache will have saved some (static) resources and it will not take as long to process and display the content. To do this, it is necessary to configure the web server to store static resources locally.
There are two ways to cache resources:
- Set the Expires value (minimum one week, maximum one year): Indicates to the browser the date on which said resource expires or is no longer valid.
- Cache-Control: It is used to specify the period in which the browser can use the cached resource without checking that there is a new version available on the web server.
Other factors that can influence page load speed
Geo location of the server
The location of the web server can influence page load speed. If we have a website hosted close to our potential market, it will reach their devices faster. Ideally we should have the server in the same country as our target audience. However, as we have mentioned, response latency can be solved through CDNs.
Have a static website
Unlike dynamic web page generators, such as Wordpress, Joomla or Drupal, static website CMS like Hugo or Jekyll do not need any databases, since all content is stored in Markdown or HTML files.
And because you do not need to access a database to generate the pages, the servers that host static websites are only responsible for sending the static files stored in the repository. This instantly optimizes the load speed of our pages in all browsers and locations.
Once we have optimized all our resources and followed the recommendations of the loading speed test, we will have to re-evaluate the page through Google’s Page Speed Insights to see if the score of the webpage has improved both in desktop and mobile.