I have setup multi-store magento website, also added full page caching plugin to speedup performance in front-end but still front-end is very slow.

Some reason I figured out from my analysis :

1) TTFB : time to first byte is 2-10 seconds in my magento front-end, as shown in below figure :

enter image description here

2) MySQL query execution time is 4-5 seconds : when I execute any simple query direct in my MySQL database then it return response in 4-5 seconds in first time, that's why any ajax taking time and return response in 4-5 seconds. My MySql setting shown as below :

enter image description here

Please suggest what will I do to improve magento site performance?

  • 1
    install Aoe_Profiler and check your slow parts
    – MagenX
    Apr 11, 2017 at 6:57
  • I installed Aoe_Profiler from here github.com/AOEpeople/Aoe_Profiler but it is not working. Apr 11, 2017 at 7:42
  • You could also use New Relic to find slow running queries or processes. Did you try to restart MySQL? Could be that one very slow running query is blocking the others, a restart might fix this.
    – Niels
    Apr 11, 2017 at 9:05
  • But the site is on production server, Sholud I do restart mysql? Apr 11, 2017 at 9:42
  • You can use full page cache. There are few extension available to do so.
    – inrsaurabh
    Apr 16, 2017 at 14:21

8 Answers 8


Here is a what I would do in your case:

  1. Install the latest Magento 1.9 on your server to benchmark against. Load it with sample data and compare its speed to the speed of your mult-store installation. If the default M1.9 is significantly faster than your custom site than go to #2 if speed is almost the same contact your hosting or pick another server/hosting - yours is simply not enough for Magento.

  2. Now you know your hosting is OK and it is either a custom extension or a custom template slowing you down. I saw you couldn't install Aoe profiler - give it another try and make it work. It will show you what part of your code is slow. If you can't install it go to step #3.

  3. Disable all of your custom extensions. If speed goes up then you know that it is one of your 3rd party plugins that is the problem. Enable them one by one and find it. Once found contact it's vendor or simply find an alternative. If disabling all plugins has no effect change your custom theme to default rwd theme. Does it help? Then it is your theme and you should contact the vendor who sold (developed) it for you.

Hope you find the bottleneck.

In my personal experience it is most probably a poorly coded 3rd party extension observer that is executed on every page request and making things slow.


An ecommerce store is full of images and banners for obvious reasons. To make sure that the images aren’t affecting your site’s performance, optimize them accordingly. The images that appear on the main site should be compressed for less data usage and easy page loads. While the product images should be in JPEG format, PNG and SVG format is recommended for logo and layout of your Magento 2 site.

One of the problems identified in the slowdown of Magento 2 sites had been the read speed of the database. If your Magento 2 store has a wide range of products, you are likely to face this problem more. To increase the read speed of your database, you should enable flat categories and products. By doing this, you can minimize the number of database joins done when it shows the products. It leads to the reduction of MySQL query complexity and your site’s performance is improved. To change the settings, you can go to your backend settings, select ‘catalog’ from the ‘configuration’ header, and mark ‘Yes’ for the ‘Use Flat Catalog Category’.

  1. Enable Flat catalog
  2. SSD
  3. Enable cache
  4. Redis for cache
  5. PHP7
  6. Mysql - latest version
  7. Also, check your custom extensions - maybe some process of event/observer stopped Magento

also, take a look, if category include a lot of products > 500 this category page will be slow

for Magento better category with no much products Layer navigation - really slow.


To improve Magento site :

  1. Enable Gzip compression
  2. Merge JS & Css
  3. add Expire geader
  4. optimize all images
  5. aviod 404 (not found) error
  6. minify js , Css & html 7.Enable cache 8.Enable Flat catalog


Before we start looking at the Magento speed optimisation steps, it is better to first discuss the choices you have to determine the actual page load time of your Magento store. Though, a quick Google search query will give you a long list of websites which will provide basic information around your website’s speed, I would recommend looking to use yslow or Google Page Speed Tool, as they are the most widely used tools and will give you accurate results.

If you already have a Magento store, I’d suggest that you check its page load time before you start the following the following performance optimisation techniques, and see how much your website’s performance improves. Don’t forget to provide your feedback in the comments section below.

Another thing to think about is that each of your page templates will have different page load speeds, because of the reliance on different files and front-end assets. It’s important to monitor and test each page type and then use the methods below to optimise each one.



If you are in the process of launching a new store and are looking at hosting options for your Magento store, the first step towards optimising Magento performance should be to find a good server, which is suitable for Magento. Really, any Magento store should be using an optimised dedicated server, but if there are cost constraints, as there usually are for smaller merchants, then you should find some reliable shared hosting company which specialises in Magento hosting.

In the past I’ve used Rackspace, Nexcess and Peer1 (all specialists in Magento hosting), as well as SWBroadband for smaller Magento websites. Sonassi also have a really strong reputation in the Magento community.


The fastest and easiest way to significantly increase your Magento store’s performance is by making some basic changes to the admin panel. The following are relatively easy things to change but can have a big impact on the load time of your website.

First of all go to System > Configuration > Catalog > FrontEnd and select “Yes” for both ‘Use Flat Catalog Category’ and ‘Use Flat Catalog Product’.

Secondly, we have to disable logging in the log settings. For that go to System -> Configuration -> Advanced -> Developer -> Log Settings and make sure log settings is not enabled.

Another important step is to enable cleaning of cron and log at regular intervals. For that go to System > Configuration > Advanced > System -> Log Cleaning, here you should enable log cleaning and set the minimum possible time which is viable for you.

Now, we’ll enable merging of CSS and JS files at the time of page loading. Although this a fundamental step in the process of improving the speed of your store, it can also cause problems, so I’d suggest you don’t look at this without the assistance of an experienced Magento developer.

Making this change will help to reduce the number of requests to the server, which will definitely help to improve page load time. To do that, go to System > Configuration > Developer. Here you’ll see Merge JavaScript Files and Merge CSS Files. Set both these fields to Yes, and hit Save.

Once this is done, we’ll run the Magento compilation process. In this step Magento will compile all of its files to create a single include path, which will help us reduce page load time by up to 50%. To run this compilation process, go to System > Tools > Compilation. In the top-right hand corner, you’ll see the Run Compilation Process button. Click on that and you’re done.

If you experience any problem in running this compilation, please make sure that the directory ‘includes’ and the file ‘includes/config.php’ are both writable.

The last change we want to make in the admin panel is enabling the Magento cache. This way Magento stores will load the resources at the first page request, which will allow the use of the already downloaded resources for subsequent page requests being loaded. This will help us to reduce page load time significantly. To enable Magento cache, go to System > Cache Management. Select all cache types and from the top-right corner drop down select Enable and submit.


Now, we’ll start making some changes in Magento’s .htaccess file. For this purpose you have to locate the .htaccess file located in the Magento root directory. If you can’t find this, try creating a new one.

This part is only really relevant to Magento websites that are using Apache servers and not Nginx – so this may not be relevant to all readers. Also, people running Magento Enterprise websites are probably not going to be using the .htaccess with Apache because it’s slower.

Through this .htaccess file, we’ll do couple of things. First of all, we’ll add expiration durations in headers. That means, until the duration mentioned in headers is not expired, Magento will keep using cached version of the files, and will not download new ones. Secondly, we’ll do content encoding to compress the files before sending them to requesting agents. As files will be smaller, they’ll be download faster.

First of all, we need to place an expiration limit on the headers, by adding this code into the .htaccess file:


First of all enable expirations

ExpiresActive On

Default expiration

ExpiresDefault “access plus 1 month”

For favicon

ExpiresByType image/x-icon “access plus 1 year”

Set Images Expiry

ExpiresByType image/gif “access plus 1 month”

ExpiresByType image/png “access plus 1 month”

ExpiresByType image/jpg “access plus 1 month”

ExpiresByType image/jpeg “access plus 1 month”

Set CSS Expiry

ExpiresByType text/css “access 1 month”

For Javascript Expiry

ExpiresByType application/javascript “access plus 1 year”


Now to enable the compression, uncomment this line of code in your default .htaccess file, so you’ll need to remove the # before php_flag zlib.output_compression on:


enable resulting html compression

php_flag zlib.output_compression on


Next, to set gzip compression into action, we’ll add these lines into the .htaccess file:


Inserting filter on all content

SetOutputFilter DEFLATE

Inserting filter only on selected content types

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript

Tackling some Netscape 4.x problems

BrowserMatch ^Mozilla/4 gzip-only-text/html

Tackling some Netscape 4.06-4.08 problems

BrowserMatch ^Mozilla/4.0[678] no-gzip

Scenario: MSIE masquerades as Netscape

BrowserMatch bMSIE !no-gzip !gzip-only-text/html

Command for not compressing images

SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary

Handling Proxies correctly

Header append Vary User-Agent env=!dont-vary



There are lots of extensions available for Magento, which enable fast caching and will help to significantly reduce page load time, but there are two which are considered to be the best options. One is Turpentine, which is based on varnish, and the other is Magento Full Page Cache. Both are extremely good extensions. Plus, the key advantage of using Turpentine is that its free, but if you’re looking to achieve the best impact in terms of performance, Full Page Cache has proved to be much better than Turpentine, but it costs around €349.

Image optimisation

If you’re using large images on your site, chances are this is going to have a considerable impact on your performance, especially on image-heavy pages. I’d suggest serving your images via a CDN, such as CloudFlare or OnePica, which will mean your images are loaded from another server and will prevent unnecessary stress on your server when loading pages.

For more enterprise-level websites, I’d suggest using Cloudinary, which is an advanced image management solution that has the potential to reduce the load time associated with images considerably. Cloudinary serves all images via a fast CDN and also allows you to dynamically serve hi-res images and manipulate images on the fly via short URLs.

JPEGmini is another good resource that’s worth looking at for image compression.


I hope these simple steps will help you to substantially reduce your page load time. If you have followed this guide and put the steps into practice and measure your store’s page load time before and after the optimisation, you should see a clear improvement. Don’t forget to leave feedback in the comments section below – any further guidance would be greatly appreciated.

Here are a few other less major things that can be done to also help to improve performance:

Avoid unnecessary redirects (adding redirects to the .htaccess will impact page load speed – this is a mistake that lots of merchants make when they re-platform and apply manual page-level redirects) Look at Memcache Use a simple, clean page template as a base Optimise your images Additional reading:

Also, I’d suggest looking at Varnish, Redis and Google Pagespeed as well, as these also represent great resources for improving performance.


To speed up your magento installation, you must follow the steps given below.

  1. Measure your website performance at gtmetrix.com or tools.pingdom.com.
  2. Step 1 will give you ranking and issue that might exist in your code base.
  3. Follow page speed guidelines given in the step 2.
  4. mostly things are taken care by .htaccess located at magento root folder.
  5. in .htaccess few things to consider. enable compression using mod_deflate, enable expiry header using mod_headers and mod_expires. Code can be found on Google.
  6. Disable magento cache.
  7. Merge CSS and JS and minify them. Do Minify HTML.
  8. Enable Cache again.

As you have mentioned, 1st response is slow then contact your hosting provider for the same. It might be issue for slow performance if above step does not solve it.

You can enable Varnish Cache too.


Follow these tips to improve your Magento performance:

  • Install and Configure Varnish Cache

  • Merge JS and CSS Files

  • Caching Magento

  • Optimize Images

  • Flat Catalog Categories and Products


Magento 2 has fixed many issues with the previous version, but there is still a lot you can do to improve performance of your Magento 2 site. If you have a Magento 2 site, the following tips to speed up magento site.

  1. Server requirement and configuration
  2. Optimize Images
  3. Enable Flat Catalogue
  4. Optimize JS and CSS files
  5. Choose the right Content Delivery Network
  6. Set off Code Generation
  7. Use Full Page Cache.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.