Magento-Exploration on cache for speeding up magento

Source: Internet
Author: User
Tags magento website

We are still working hard to speed up magento. In addition to the built-in cache and compilation, many of our previous efforts started with reducing loading times such as JS, CSS, and images, the loading time of the page is sometimes the largest part-the page data is not processed too much. For example, the time consumption of each request is checked using firebug (the data is affected by many factors, for reference only ):

 

We can see that the loading time of JS and CSS is generally calculated in dozens of milliseconds, while loading the first step of page data takes nearly one second, shortening Js in various ways, to make magento run faster after loading CSS and images, you have to try to shorten the "781ms.

 

Because of magento's complex code architecture and EAV-mode databases, a large number of PHP files and a large number of data tables are read during each page loading. The built-in cache caches some common data into files, instead of reading the database every time, this reminds us that we need to cache common data on the page to reduce the need to read PHP files and databases. I can't remember where I saw an article saying that magento's built-in cache scheme is quite conservative, with very little cached data. When loading pages, I still need to read a large amount of data from the database. All we need to do is to improve the caching scheme and cache more data into the file.

 

My research on caching is not very deep. My personal understanding is divided into two types: full-page caching and partial caching. I will illustrate my point of view with two cache plug-ins I have tested as an example.

 

The first plug-in is a full-page cache plug-in-Performance Booster. The address on the official website is. The code of this plug-in monitors a large number of events to refresh the cache. For example, when the product information is modified in the background, the corresponding cache is refreshed.

 

It is said that this plug-in has taken into account the situation that may need to refresh the cache, But I encountered trouble when using it. Magento is a highly open system. You can install a variety of third-party plug-ins or write new modules on your own. The plug-in cannot take into account the need to refresh the cache in addition to the built-in modules of the system, this causes some page data to change in the background, and the foreground is not refreshed or some functional blocks are directly abnormal and cannot be used. Most of my projects are equipped with many plug-ins and modifications, so it is difficult to use this plug-in.

 

The second plug-in is a free plug-in-catalogcache. The address on the official website is. After testing, you can enable this plug-in on the list page and product page with a large number of products, which may increase the speed by around 100 ms-to Ms. Because only two blocks are cached, the plug-in only works on the list page and product page.

 

This plug-in is simple and highly targeted, so you don't have to worry about its impact on items other than the list page and product page. It has been used in a formal project after a period of test. Of course, the recommendation of this plug-in is not the main purpose of this article, but it makes me feel that using the same method to write cache to various common blocks is a safe and practical way, although the effect is definitely not as fast as reading static files directly, you do not need to worry about which part of the whole page cache will be missing because it is written in blocks by yourself. That is to say, no matter how many third-party plug-ins you have added or how many features you have written, you can still use this method for optimization and selectively cache the local data.

 

In my opinion, the whole page cache is not adaptive enough to cope with different project situations. If your magento website only sets a template on the default function, you can try the first plug-in. If there are many third-party plug-ins in the project, or even a lot of secondary development, the entire page cache solution will be abandoned. Therefore, partial caching is what I think is best suited to magento. Although it is not as effective as full-page caching, it is more flexible, secure, and adaptable.

 

Your superficial point of view. Welcome to shoot!

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.