Google has launched a new ranking algorithm for mobile search. The page loading speed on mobile devices now affects the site’s position in Google’s mobile search. But what to do if the site loading speed is low?
First of all, it’s important to use a stable hosting. It depends on what CMS you use, but I strongly recommend this Magento Hosting. If you have a good one, so the answer to this question is a universal list of recommendations, due to which the speed of loading pages of the site not only for computers but also for mobile will increase. For a better understanding, the items are arranged in increasing order of labor and efficiency. Here are some ways to increase site performance that we recommend paying attention to.
1. Image Optimization
To increase the loading speed of page elements due to image optimization, we recommend:
use png images on the site (currently the most effective webp format is not supported by all browsers);
use quality compression for images;
use a size of the loaded image that matches the size displayed on the page, i.e. The browser should not compress or increase the size of the image;
initially load only those images that are visible to the user when the page is opened, and for the rest of the images, it is recommended to use Lazy Load as you scroll through the page.
Only load scripts and styles that are used on the page. The browser should not load extra scripts or separate style sheet files if they are not used on the page in question.
Do not load separate small JS and CSS files, in order to avoid the formation of unnecessary server connections that slow down the site. We recommend embedding such files in the HTML code of the pages using the <script> and <style> tags, respectively.
Postpone loading additional scripts and styles using defer or async attributes. This will allow the browser to display the page content without delaying the loading of styles and scripts.
Apply minification to all JS and CSS files, which will remove extra characters and empty lines / spaces. As a result, the volume of each file will be reduced.
For scripts, Google recommends using the technologies UglifyJS and Closure Compiler, for styles – CSSNano or ccso. (link to google recommendations https://developers.google.com/speed/docs/insights/MinifyResources)
3. GZIP compression
Gzip is a method of compressing files to an archive, reducing their size and delivery time. Among the benefits of gzip:
fast compression and decompression of files;
compression without loss of quality (files are completely restored during unpacking);
support by modern browsers.
Gzip compression is used for html files, styles, scripts, text documents. This allows you to reduce their weight by several times. Media materials, such as pictures, video materials and docx, xlsx documents, are poorly or practically uncompressed.
The main disadvantage of Gzip technology is that it takes time to compress files. That is, if the server is not powerful enough, milliseconds can be lost. Therefore, as a rule, the fastest gzip compression level is used – 9. It is also impractical to compress files weighing less than a kilobyte, since the gzip headers need an initialized location.
4. Service subdomains
With a large number of scripts and images on the site, we recommend their removal to a separate service subdomain. This will make the site “easier” and increase its performance.
We do not recommend transferring to the subdomain the graphics used to render pages on the site. But it is better to transfer photos of goods, services and similar images to the service subdomain and upload from a separate server.
Using subdomains will allow the browser to simultaneously download a larger number of files from different servers, which will speed up their work and positively affect the page load time.
The remoteness of the user from the server is one of the factors affecting the speed of loading a web page. If you are the owner of a large site, we recommend using CDN technology.
CDN (content delivery network) or data delivery network – a chain of servers located in different parts of the world and responsible for the rapid delivery of content to the user.
That is, the download speed is reduced due to the user receiving information from the server closest to him. At the same time, the load on your own server is reduced. When connecting a CDN, you must carefully check the providers for the presence of servers in the regions that your site is oriented to.