Magento optimization

Friday, 19 September, 2014

This is a broad topic and every situation is unique so it is impossible to cover everything.We will try to mention a few common problems and tips for most of them.

Different professionals use different methods for Magento optimization. Many people who use Magento advise full page caching, compiling, flat tables, APC and Memcached. In case of any trouble, you should first try and to determine the root of the problems. It often happens that customers buy expensive extensions or get a bigger and better hosting, but the problems remain. There is no universal cause, but you should always start from the simplest things, where most of the people tend to make mistakes.

This is quite a broad topic with many different situations and examples. We will mention only few most common problems and solutions for them, as well as few tips and tricks.

First step


Second step

1) Review the access log for bots (bots, spiders, crawlers…) and deny access (robots.txt, .htaccess)

Remove all spam bots (for example, Baidusearch). Leave out only targeted (Google and Bing) bots. All good bots follow the robots.txt. The “bad bots” are a problem (this can be quite dangerous; hosting might cancel the service, and the dedicated load might drastically increase. This leads to processors overheating (hardware might get damaged). Intel processors have a “step-down” which reduces the power. It cools down the processor, but slows down your site.

On the other side, you can remove “bad bots” from your site in several ways; iptables and ban their IP or even a whole range of IP-s. We also recommended that you use fail2ban software.

2) Check if the number of visits has increased

If it has, consider optimizing your installation – e.g. Full Page Cache can speed up your web site over four times the original speed.

And even better solution is Varnish on the front of HTTP server. We also recommend free Turpentine module for Magneto. When a user opens a page, Varnish saves the entire page in HTML and serves it to future users. Some URLs are specific to each user (a user dashboard, checkout and similar pages) are not cached.

3) Try to include flat tablets (categories and products)

If you do not plan on adding new modules you can turn on compiling. It can decrease loading of pages by 50% (some modules create problems with COMPILER. Before starting you should check the compiler. Also, you should check your test modules).

4) If you don’t have a programmer available – hire one.

It is necessary to benchmark certain parts of the code (to define whether one of the modules is responsible for errors), and refactor custom modules (if they are the problems). The easiest way is to disable them is one by one while measuring speed of the page.

If that doesn’t help, try Xdebug to see where the problem occurs and start from there. Do not buy a more powerful server just to “drown out” mistakes made by the programmer. If the module has badly written code it is usually better to rewrite the module from scratch.

5) Check with your server admin what is exactly happening with the site and ask which version of PHP and which services are on your server (Nginx or Apache).

The environment in which PHP is working is very important. Be sure to switch to PHP-FPM. If the PHP is working in PHP-FCGI mode it is wise to install XCache or APC and Memcached.

Tips and tricks

1) Domains – Domains might have incorrectly configured DNS records or miss-configured name servers. Users will think the site is slow even though it has nothing to do with the server.

2) Optimization of front-end – minimize JS and CSS. Merge JS scripts (smaller number of requests is better).

3) Facebook and other social plugins – you should load this asynchronously. In our experience, social plugins can take a long time to load – up to 700ms!



Sebastijan Placento


  • Harry

    There is a very useful way to optimize Magento site speed is deferring JavaScript loading till the last moment after all HTML and CSS. It means that JavaScript files are put to the end of page, therefore the web browser will load HTM and CSS before loading these JavaScript files. This leads to loading time be reduced and magento site perform faster than before.
    To make this JavaScript parsing easier, we had better not do it manually, let’s use an extension instead because of convenience and simplicity.
    For example:

© 2017, All Rights Reserved. Gauss Development is Gauss Ltd brand.