How to increase page loading speed on a website
One of the basic SEO recommendations for improving the behavioral factors on the site is the need to increase the page loading speed. And indeed: the faster the site works, the more pleasant it is to use it, and both visitors and optimizers agree on this.
Why is the site running slowly?
What happens when the page opens? At this point, the content is transferred to the client, search engine, parser or browser. Four factors affect download speed:
- how far (geographically) the server is located from the client;
- what content is transmitted - codes or images;
- How exactly is the data transferred?
- how the content is generated.
What can be influenced? Of course, first of all, on the Front-end and Back-end of the site, that is, directly on the type of content and the way it is generated. But the remoteness of the server from the client is not always subject to the owners of the resource. However, there are acceleration technologies here too.
The greater the distance between the server and the client, the higher the ping will be - the very time for which a certain packet of information is transmitted. But it's not just time that matters. Both the route and the overall congestion of the channel are important. Keep in mind that DNS requests from each page are sent to each of the domains mentioned on the page. But when choosing a good server, you will not notice any problems: often the total connection time to the servers does not exceed 2% of the total download time.
Content Type or Front-end
Content should be optimal in size and properly distributed across the page. Here are the main problems in this category that prevent the site from working quickly:
Images: can be large and very large, the wrong format (JPEG loads much faster than PNG-24), too high resolution (for example, a print layout instead of a regular photo). You need to use special plugins for image processing, as well as control the "technical characteristics" of all photos and pictures that you are going to post on the site. site statistics can be used to estimate the volume of images. It's also important to keep the number of images to a minimum, leaving the ones that really matter, in order to reduce the frequency of server calls.
Transfer rate: ways to optimize
If it is not possible to recycle the content, you can increase its bit rate. There are 6 technologies for this. They can be tested independently of each other and choose the appropriate option:
- Text compression . This download acceleration method is recommended by HTTP1.1. For compression, in most cases Gzip is used, a popular algorithm in Unix systems. The compression method is similar to that used in zip archives. Thus, you can reduce the amount of textual information (including program code and html, but not pictures). You can check the compression by running "test server response" in Webmaster. You can also use the .htaccess file with instructions added to it for compression.
- Browser caching . When caching, the browser saves a copy and opens the already copied and saved copy of the page. The server sends information about page changes to the browser. There are several types of headers sent by the server - for example, Expires, by the time until which the content is considered relevant, or Last-Modified, by the time it was last modified. Before showing the page to the user, the browser checks all allowed headers. Therefore, the visitor always sees up-to-date information. It is better if the content is generated from the very beginning by the php service programming language. This will help provide better control.
- HTML cache of dynamic pages on hard disk. The cache can be stored on the hard drive or in the server's RAM, so the pages will open as quickly as possible. But the professional implementation of caching technologies is very important, otherwise you can overload the RAM. There are several popular caching plugins.
- Asynchronous loading In this case, plugins are loaded in parallel with the base content. To enable this method of loading, it is enough to add the async attribute to the script tag.
- CDN technology for parallel downloads. You can transfer some of the content to another domain or create a subdomain to store the heaviest parts of the site. CDN technology allows you to place static content on a network of distributed servers, minimizing the impact of the geographical factor. To launch this technology, they turn to CDN providers.
- The HTTP/2 protocol , which allows you to download all files in parallel, as a single stream. However, a server software update may be required to run the new protocol.
Content generation methods
The performance of the site is greatly affected by the work of the server, that is, the immediate response time when loading the page. If a server response is not reached within 10 seconds, Yandex.Metrica may consider the site to be inoperable.
Server speed is affected by preset settings. Most often, the Nginx + Apache bundle is used for high-quality sorting of requests and their fast transmission.
You also need to choose the correct PHP mode. By default, it works in CGI mode, which is not very productive. The mod_php mode provides more performance but is resource intensive. For high-load sites, you will need FastCGI (or FPM) mode.
The server may take a long time to respond due to the long processing of queries to the databases. When working with a database, it is important to check all the settings, including: the volume and efficiency of the query cache, the number of allowed simultaneous connections, the amount of physical memory on the server. You can set up long queries, and then determine which of them load the database for the longest time.
All of these are effective ways to optimize website loading speed. More specific recommendations can be given only after analyzing a specific resource.