HOW TO SPEED UP A WEBSITE ON 1C-BITRIX |
HOW TO SPEED UP A WEBSITE ON 1C-BITRIX Over the past three years, we have optimized the performance of many projects on 1C-Bitrix. Among them were both new sites that were hosted for the first time, and projects transferred from other hosting and corporate servers. In this article, you will learn the basic steps that we recommend to increase the performance of the site and make it faster for visitors and search engines. With the right settings, it is quite realistic to make the “slow” site “fly” and delight visitors with convenience and high speed. So, here are 14 steps to optimize the site on 1C-Bitrix: Use a specialized Bitrix environment. Minimize scripts and styles. Track and fix slow queries. Compress images. Postpone downloading media content. Configure the cache lifetime. Enable CDN. Update the PHP version to 7.1 and higher. Disable unnecessary modules. Optimize database settings. Create faceted indexes. Enable the InnodDB table type in the database. Configure innodb buffer pool size. Use the memcached caching mechanism. Enable composite mode. For sites with a high load, consider using a server cluster. Let's look at each of these steps in more detail. If you are setting up hosting for a new project, it is important to choose a server configuration that corresponds to the “voracity" of the site and the expected load level. And only then do fine-tuning based on performance monitoring. We know that Bitrix is very sensitive to processor frequency, disk speed and memory capacity. Therefore, several ready-made configurations are provided in the Maxiplace hosting templates. On them, most of the sites that move to us from regular hosting sites immediately begin to show higher performance. For websites of companies and online stores with a small attendance, 1-2 processor cores, 2 GB of RAM and up to 30 GB on an SSD disk will be enough. This configuration is also suitable for those who have just launched the site and have not yet measured the traffic load. If your site is quite “heavy”, you will need more resources. So, for sites with high traffic, as well as online stores with a large catalog of products or portals, for example, Bitrix24, we recommend using the “MIDDLE” tariff with 4 processor cores, 4 GB of RAM and 80 GB on an SSD disk. In terms of cost, the transition from the minimum configuration to the average is comparable to the cost of one (!) small order in an online store (about 2 thousand rubles). And the result can be both an increase in orders due to the acceleration of the site, and an increase in the position of the site in the search results. After strengthening or optimizing the hardware, we proceed to setting up the environment and the site itself. If you are setting up hosting for a new project, it is important to choose a server configuration that corresponds to the “voracity" of the site and the expected load level. And only then do fine-tuning based on performance monitoring. Use a specialized Bitrix server environment It already takes into account many parameters that affect performance. A set of software and a bunch of web services have already been configured to ensure optimal operation of the site on 1C-Bitrix or the Bitrix24 portal. If you do not use the Bitrix environment, but configure the environment yourself on your VPS server, pay attention to the mode of using php as an apache module. You will see this option in the settings and can use it to speed up the work of Bitrix. At the same time, there are many nuances, since with a high load, another mode will be preferred, and you will have to involve a specialist. Therefore, for convenience and speed of deployment, we recommend using a ready-made and repeatedly tested BitrixVM environment. We use it for all client projects on the Bitrix platform. You need to check the PHP version and update it to 7.x, because new versions work faster. When the basis of the server part is configured, it's time to move on to the settings that are made from the 1C-Bitrix admin panel. In the settings of the main module, you need to check the boxes, as shown in the screenshot below.
Compress Images For Bitrix, there is an excellent free solution for optimizing images without loss of quality. It works literally in one click.
Image optimization in Bitrix Imagine how slowly such an online store loads if there are 40 thousand products in its catalog.
Configure cache lifetime If the information on the site is updated once a day, it will be a mistake to leave the default cache lifetime (3600 s). It is necessary to set the value 24 hours (86400 s), otherwise every hour the visitor will re-download content from the server. It is important to take this parameter into account and set it taking into account the period of actual updating of information on the server. To enable this option, go to Settings - 1C-Bitrix Cloud - Site Acceleration (CDN).
CDN Site Acceleration In the panel there is also a tool for measuring the loading speed of the site response. It measures the site loading speed of visitors. This test shows four zones - “Very Fast", “Fast", “Slow” and “Very Slow", as well as the average loading time. Calculated for the last 1000 visitors to your site. The speed of the site actually shows how quickly your site was displayed for most of these 1000 visitors.
Sites with this type of tables work faster and more reliably in terms of data security. This corresponds to the recommendations of Bitrix. For example, you decided to find information about the BMW M5 on the website. Without using a faceted index, the search would be carried out first by car brands, and then by model range. Faceted indexes pre-determine the possible options and the search will give the result faster. Settings > Product Settings > Composite Site > Settings > Composite Click "Enable Composite" You also need to set the cache lifetime for a day (86400 seconds), since 120 seconds will degrade performance.
Disable unnecessary modules Another example of such a module is “Site24”, which allows you to quickly create simple sites on 1C–Bitrix without a web developer. It can also be disabled to speed up the work of the main site. For example, engineers analyze the load and see that most of the requests come from the MySQL service. At the same time, according to monitoring data for the previous days, there was no increased load before. First, engineers try to find out from the client what exactly has changed on the site. And if the client can't say for sure, then engineers use special tracking utilities to see which queries are running slowly or creating a high load on the database. These are utilities: mytop mysqldumpslow pt-query-digest (required if Percona Server is installed) Sometimes you can see that resource-intensive cyclic queries have appeared on the site, which slow down the work. We point them out to the customer. He understands what code changes they are caused by, and takes measures to correct the situation. You can see some of this in the Bitrix admin panel yourself by enabling performance tracking and not contacting engineers. This will help you understand what changes on the site or in the logic of its operation lead to such slowing requests. In the performance panel there is an opportunity to look at the indicators and analyze in detail the page loading speed.
WHAT KIND OF PERFORMANCE GAINS CAN YOU EXPECT? Optimizing MySQL queries can give a lot depending on the queries themselves. If the site was working very slowly, showing an index of 20-30, then after eliminating a slow query, the index can rise to 100 points. Here is one example: The customer contacted us with an online auto parts store with a large catalog. The site opened very slowly. We looked at the performance by pages. The main page opened quickly, the transition through the sections, too. And when opening product cards, the site began to slow down. So, the product page was loaded for 25-30 seconds. We looked at the server – there was no special load at the same time. They began to find out from the customer what he was doing on the site before the problem appeared. The customer remembered that he had included a module for applying watermarks to images. At first, the module worked fine, but then the disk began to overflow, and the customer disabled this module. Apparently, the module did not turn off completely and began to cause a huge delay when viewing products. As a result, the client reinstalled and removed this module, after which the problem disappeared.
Additionally, engineers set parameters based on the specifics of each individual site to ensure its maximum performance. For projects with a high load, sometimes you have to come up with separate solutions. We felt that even the maximum performance of one server would not be enough. The company asked us what can be done in this situation. Of course, there is a boxed solution – the Bitrix Enterprise package, which allows you to host sites on multiple servers to cope with a high load. But this solution is very expensive, costing hundreds of thousands of rubles. The customer has not yet considered such investments. Therefore, we suggested creating a simple version of a scalable cluster without having to buy an expensive license. We placed the content of the site on two servers called “php backends”, and added a separate server as a load balancer. He distributed the load between the two servers depending on the number of requests to the site. The database was moved to a separate server. Testing has shown that the maximum number of requests (RPS) that a cluster can handle has grown at least three times compared to a single server. At the same time, it became possible to further scale the cluster by adding additional backends. With the next jump of visitors, such a cluster solution coped with the increased load, and the problem was solved. Thus, the client received a cluster solution without having to pay hundreds of thousands of rubles for the purchase of an expensive license. The task was solved with an order of magnitude smaller budget. Firstly, fast sites that “fly" have a “wow effect” for visitors. In comparison with them, competitors' sites seem even slower and delays when working with them begin to annoy. And the fast website that stands out against their background not only confirms that the company has invested in technology and thought about user convenience, but also creates an “attraction effect” - you want to stay longer on such a site, return more often and make more transactions. And secondly, as noted by many of our customers accelerate page loading website increases its position in the search results Yandex and Google. And this is a direct commercial benefit. We have tried in this article to write about those techniques for increasing the download speed that can be used independently, or to seek advice from our specialists. We will be happy to help speed up your Internet project as well. If you have something to add to these methods or you want to share your own – write in the comments. It will be useful to everyone who works in this direction. Go back |
27-12-2022, 13:17 |