Making Your Magento Site Better: Performance Optimization Guide

Posted On June 8, 2017 by Anca Iusan

When it comes to online marketing, it’s mandatory to provide a good shopping experience for your customers. As strange as it may sound, an online store can lose business faster than it can make it. Statistics show that it takes only 3 seconds for a user to decide to leave a website. If it is not responsive and/or it loads too slowly, they won’t wait that long. This is why you need Magento performance optimization. How can you optimize Magento performance?

If an e-commerce site is making $100,000 per day, a 1 second page delay could potentially cost you $2.5 million in lost sales every year.” [Kissmetrics]

eCommerce customers are not patient these days. The loading rate of a website is an important factor search engines take into consideration to decide the ranking of every web page.

Customers usually expect a web store’s page to load in 2 seconds max. Statistics show that after 3 seconds, almost 50% of the users abandon a web page if it is not loading. They choose to go to a competitor instead.

Additionally, the performance of every website has a great impact on the users’ experience. It directly influences the conversion rate of every business. So, making the necessary efforts to solve your performance issues will help you get the best out of your Magento web store. Even a 1-second delay on a page response time can lead to a 7% decrease in conversion rates, according to research made by Aberdeen.

Thus, it is advisable for every Magento owner to measure the store’s performance. You need to check the technical documentation we have prepared in this guide to solve loading speed related issues. That is the foundation of Magento performance optimization. You can enjoy the improved performance for your Magento store by installing performance-enhancing extensions. These will boost user experience and, ultimately, increase sales.

Measuring your Magento store performance

magento server performance
Magento Performance – Image Source:

Testing your site’s performance

Before going any further to the Magento performance checklist, we prepared for you below, hold on a minute. Let’s take a quick test to find out how fast your Magento store is loading right now. It is useful to see how you managed to make your Magento site more responsive. You will know this based on the techniques you’ll learn about in this Magento performance guide.

You need a Magento performance toolkit to test your site. You can either use simple online tools or opt for more complex ones, like the Magento Profiler.

When it comes to online tools, here are a few recommendations to check your site’s speed and Magento performance optimization:

These online apps typically give you a score and a range of recommendations on where you can make improvements. While definitely good for a quick first check, they won’t be able to see beyond the frontend of your site. That means if your site is having performance issues, especially due to high loading times, these tools won’t show you exactly where the problem is.

This is why Magento comes built-in with an internal Profiler. It allows you to delve deeper once you found out about the issue.

Troubleshooting performance issues using Magento Profiler

To identify your Magento performance issues, you can use Magento Profiler. It will assist you in finding out which specific processes use too much of your resources. This could be database queries generated by customer activity on your Magento store.

Before you begin

With the help of the Magento Profiler, you can make a thorough analysis of your store’s performance. But before running a performance audit on your server, check your image optimization. Be sure that you have solved any issues related to this. Also, check CSS and javascript files and other frontend problems. You have to be certain that your website problems are actually related to the server.

Also, you will want to check if there are any database related issues that might slow down your website. To do this, login into MySQL and run “show processlist” to browse all the slow pages of your website. When a query stays on the screen for too long, you’ll know you have a database performance issue. Go ahead and solve this first before going further to enabling Magento Profiler. See what other processes may cause your store to run slow.

Magento Profiler’s Purpose and Use

Magento comes with a Magento performance toolkit. It helps you troubleshoot your Magento performance-related issues. You can figure out precisely what processes overloads the activity on your website.

 By activating Magento Profiler, you or your developer team can examine the code relevant to server processes. You can also check loading time to help you diagnose the technical problems your site is facing. For instance, you can enjoy the Profiler’s assistance to decide if an extension you installed is generating some issues related to your store’s performance.

Magento Profiler can help you decide what your priorities are. Then, you will use them to make your website run faster and increase your sales performance.

Magento Profiling – Who can do it and how?

Note that it is not advisable to use Magento Profiler on live sites. You need a basic understanding of PHP and Magento to do it. Else you should get assistance for Magento performance optimization from your Magento developer team.

To enable Magento Profiler, go to System/Configuration/Developer/Profile and set it to “Yes.”

Enable Magento Profiler – Image Source:

This will enable the profiler. But you should also go to your root index.php file and look for the commented Varien_Profiler::enable(); line and uncomment it. If the code is not there, then paste it before the following line: Mage::run($mageRunCode, $mageRunType.)

You can then refresh the page. You will see at the bottom of the page a performance table similar to the one illustrated below:

Magento profile data – Image source:

The table columns indicate the following data:

  •   Memory usage in bytes
  •   Code profiler specifies the code is being executed
  •   Time shows in seconds the total amount of time the code takes to be executed
  •   Cnt is the time count a single block of code ran to generate the output
  •   Emalloc is the amount of memory in bytes PHP assigned to this operation
  •   RealMem is the amount of memory used to process this operation

Analyzing the content of the table, you can make further decisions on how to improve the performance of your Magento store. Whether it’s to fix or replace a buggy extension, optimize your theme or the database.

Improving Magento performance: How to make your Magento site load faster

Magento Performance
Improving Magento Performance – Image Source:

If your Magento site is running slow, we have good news for you. We have the best tips and tricks you can use to speed up your website and make your Magento store more responsive. In this chapter, you will find the best practices to improve your Magento performance.

Our guidelines contain all the technical details you need to know to measure your website’s performance. Learn how to set up your Magento store indexing settings, caching options, tools, and other solutions to improve the loading speed. These will help you offer the best shopping experience for your customers.

load time conversion rate correlation
Conversion Rates versus Load Time in Magento – Image Source:

Magento Index Management

Indexing your Magento website helps you increase the loading speed for your frontend pages.

What indexing does is actually store all information related to your products pages and category pages. It puts it into more easily accessible collections of data so that they can display faster.

What happens when your website doesn’t have indexing enabled? All the necessary information it needs to provide will be generated in real-time. This means everything will be more difficult to access the server and especially for your users.

For example, the price of every item will be calculated in real-time, based on the price rules and discounts you have set up for your customers. Also, layered navigation will be generated in real-time based on all the attributes your products have available, and so on. So indexing is indispensable if you want to offer your customers a good shopping experience.

Managing Indexes in Magento

There are two ways you can index your Magento store. This can be automated reindexing and manually reindexing new data about existing products on your website or new product pages/categories you want to make available to your customers.

The default settings for each alternative are stated in Magento’s system configuration. By default, all indexes are set to “Update on Save.” This will trigger reindexing whenever a change is made from pages/categories Admin mode.

The manual updating option requires reindexing every time you change one of your product’s attributes. You can also override the default settings for indexing, and you can do this from the Action control menu.

How to manually reindex your Magento store using SSH?

To enjoy a better webstore performance, you can choose to manually reindex your Magento store. To be able to do this, you will need SSH access to your web hosting account.

Once you have it, log in to your account via Secure Shell Protocol. Go to the installation directory in your Magento store to execute the following command: PHP shell/indexer.php reindexall. This command will start the reindexation process. It is meant to update all data on your website.

If you have a big database, it is advisable to manually initiate the reindexing process at midnight. You can also do this when the activity on your website is lower to avoid loading up the server. Remember, your website’s performance will be affected during this operation, so make sure you choose the right time to do it.

Automated reindexing in Magento

Reindexing your Magento store can take a while, depending on the following aspects:

– the total number of products you have on your Magento store

– the number of store views your Magento store has during reindexing

For that reason, large websites opt to have the reindexing process be done automatically once per day. This is usually at a very late hour so that users don’t encounter performance issues. This can be done by setting up a cron job on your server with the command mentioned in the manual indexing section above.

Magento cache management

How can cache management improve your Magento store’s performance?

By using Magento’s cache management system, you can benefit from faster data delivery for your customers. You can also improve your overall web store’s performance and scalability. Your website will be able to handle more user requests at the same time without crashing.

Having in mind that Magento is a database platform, managing your cache will greatly improve the loading time of every query your customers perform on your website. This will replace the time-consuming processes which need many queries of the database and slow down your website.

Knowing how to manage your Magento cache system will improve your webstore loading speed. It will also create better user performance. Thus, it will boost your website’s capability to serve the same content to a bigger number of customers at the same time. In the end, all these benefits will lead to better sales performance. Why? There is an increased conversion rate and a higher website ranking from search engines.

What is caching? How browser caching and server caching work?

Every request made by a customer can load your server’s activity, but here is where caching comes in. Using browser caching and server caching can help reduce the number of requests that are sent to your server.

Managing default caching in Magento

Magento’s cache management system is designed to improve the performance of your Magento store.

The system will send you a notification when the cache should be refreshed, and the steps you need to follow will be presented to you. After taking the indicated steps, make sure you refresh your browser to see the most recent files.

You can find Magento’s cache location in the var/cache directory in the root of your store. Easily manage this from the System / Cache Management menu.

Magento has the following types of cache, each of which can be used to improve the loading speed of your store and provide a better shopping experience for your customers:

  •   Configuration
  •   Layouts
  •   Blocks HTML output
  •   Collection Data files.
  •   Database DDL operations
  •   EAV types and attributes
  •   Page Cache
  •   Integrations Configuration
  •   Integrations API
  •   Target Rule
  •   Translations
  •   Web Services Configuration

In the cache management dedicated section, you can choose to remove different types of cache by using the following actions:

  •  Flush Magento Cache will remove all items stored in the default Magento cache directory which correspond to Magento tag
  •  Flush Magento Storage will remove all the items which are stored in the cache directory.
  • Flush Catalog Image Cache will remove all automatically resized images stored in the catalog/product/cache location
  • Flush JavaScript/CSS Cache will remove all the copies of merged JavaScript and CSS files from the cache directory
  • Flush Static Files Cache will remove all preprocessed view files and static files

Full Page Caching

 What is the Full Page Caching for Magento?

Full Page Caching is a caching solution designed for high-traffic Magento-based platform websites. It works by storing the full output of a page in a cache directory. This will serve the same page content to later requests users make to that very page, without loading up the server. FPC will also improve the performance of your website. It will avoid crashing in the busiest time slots of your webstore.

Enterprise_PageCache is available by default in Magento Enterprise. It is also useful as an extension for all online stores built on the Magento platform.

FPC Benefits

With Full Page Caching, your Magento online store can benefit from quicker loading time. Enjoy an increased number of requests per second and a decreased latency for loading up a webpage. At the same time, FPC helps you improve the functionality of your server by unloading it from the unnecessary processes it needs to serve if you’re not using a caching solution.

FPC Drawbacks

Full Page Cache comes with some difficulties, especially on the dynamic content of your Magento store. However, by using placeholders and containers, FPC can process the dynamic blocks of content. These include the shopping cart or every customer or the account links. It then connects them to the static content of a page served from cache directories.

FPC is one of the best solutions for e-commerce websites. It provides all the specific Magento optimization performance parameters needed to deliver a personalized dynamic page to each end-user.

If you’re on the Community version, you can opt for extensions in order to gain the benefits of FPC (unless you’re on Magento 2, which has FPC built-in). Some of the popular caching extensions are:

As mentioned, Lesti’s FPC extension is free. However, it is limited in certain features and does require a separate extension that handles the crawling. Once FPC is enabled, crawling assures that pages are cached before users access them. Most paid extensions include this feature.

Advanced Caching Solutions for Magento

If you’ve enabled Magento’s built-in cache and configure full page caching, do this. You can further optimize your performance via several more advanced caching solutions. These are mostly installed and configured outside Magento.

There are several types of cache storage that can be integrated into Magento. Some of them are for general use, while some target specific data and processes. In what follows, we briefly discuss each of them to help you make the right decision and improve your Magento store’s performance.

Backend Caching Solutions

A backend caching system is often used to solve specific errors which can appear while using the Magento’s default file-based caching system. You can choose one of the following backend caching solutions: Memcache, APC, Redis , MongoDB, Rubic.

Although all of them can be integrated in Magento, it is not advisable to run them simultaneously, so you have to choose only one backend caching solution. We recommend you to use either MemCache or Redis.

Session Stores Caching Solutions

A session is an interactive data exchange between two computing systems, and it is also known as a login session. As the name indicates, the information interchange is unique for every user.

During a login session, user-specific data is stored on the server for each customer. The server then maps every end-user with its session using cookies. Items added to a cart are displayed from the session storage when a user returns to the store. How the server manages to display the session to each user can greatly impact the loading speed of your Magento store.

OpCode Caching Solutions

OpCode Cache is used to improve the PHP server’s performance. OP cache uses shared memory to store data so that the server will not need to parse scripts on every request users make on your Magento Store.

Installing this type of caching on your server requires no additional configuration. You can control OpCode Cache from the backend of your Magento store to reset the cache. You can also check how OpCache works in real-time, as the specific charts reload every 5 seconds.

You can choose one of the following OpCode Caching Solutions: APC, XCache, Eaccelerator, and Zend OPCache. Although you can install multiple OpCode caching solutions, it is advisable not to do so. Why? Because the performance improvement will not increase significantly.

Reverse Proxy Caching Solutions

Reverse Proxy Caching is designed to effectively improve a website’s performance. A proxy cache server functions as an HTTP client between your end-users and your web server. This solution offers lots of benefits as the traffic which is received through a reverse proxy can be monitored. You can filter data flow and set up additional security configurations.

The most popular reverse proxy caching methods used are nginx and Varnish. Our recommendation is to use the latter, which we will unfold in the following sections of our performance guide.

Advanced Caching Tools recommended for Magento

To improve your Magento web store’s performance you can simultaneously use different advanced caching solutions. The most popular ones are listed below:


MemCache is an open-source generic caching system that can be integrated into Magento. MemCache is designed to decrease the database load and reduce the number of times an external source (a database or an API) must be accessed to provide the specific data of a search request made by end-users on your Magento store.


Redis is another open-source generic caching solution that can be implemented in Magento. It uses an in-memory data structure store as a database cache. It also supports different sets of data, such as strings, hashes, lists, sets, and sorted sets with range queries. Other data are bitmaps, hyperlogs, and geospatial indexes with radius queries.

Redis can be used for PHP session storage, and it has powerful features that are not supported by Memcached storage solutions.

Redis relies on database queries and disk reads. But, it has significant advantages that can increase the efficiency of your Magento store. These include caching data and serving it significantly more quickly. It is volatile, especially during server crashing, and can be used across multiple servers.

The Alternative PHP Cache – APC

The Alternative PHP Cache is a PHP extension that can be integrated at the server level of your Magento store. It will help you improve your PHP server’s performance (see OpCode Caching above). APC caches the compiled operation codes of PHP scripts and enables your website to display the content of a page more rapidly to end-users.

To use APC with Magento, you just need to install the PHP module and restart the server. Your Magento website will immediately improve its loading speed.

Varnish Cache – VC

Varnish Cache is a powerful open-source HTTP engine and reverses HTTP proxy. It is specially designed to help you dramatically improve the speed of your website. VC can be installed on Magento to improve your online store’s overall performance.

Check out how more about how you can benefit from using Varnish Cache Server with Magento in the next section.

Varnish Cache Server with Magento

What is Varnish Cache and how it works?

Varnish Cache is one of the best solutions for full-page caching you can use for your Magento store to improve the loading speed of your website.

Varnish Cache is an open-source HTTP reverse proxy that can be installed locally on your server or on a distributed server network. It is designed to deliver a storage copy of a web page. This is actually a cached version of a page located on your server. It will process all requests users make to access that specific page by displaying its copy.

Varnish Cache acts as a server that runs at the halfway distance between the interface of your website the end-user sees and your Magento web server. It is responsible for managing the requests users make and serve them the relevant content they want to see from cache directories.

Varnish Cache Tool for Magento 2 – Image source: Magento DevDocs

To make sure your Magento gets the best use out of Varnish Cache, you should cache as much content you can. These include partially dynamic pages and HTML elements in order to reduce the amount of work your server has to do. Your Magento website will enjoy improved scalability and performance for your store.

That means that Varnish caching should not replace other types of caching you have installed, such as a Magento Full Page Cache extension. It is best that they are used together to maximize the number of concurrent users your site can support without suffering from performance issues.

What type of content can Varnish Cache serve?

Varnish Cache works with both static and dynamic elements your website contains to ensure faster navigation for customers on your Magento store.

Caching Static Objects, such as images, Cascading Style Sheets, and JavaScript files. These are the elements that are served to an end-user whenever a request is made on your website, no matter how many products a user has selected from your store.

Caching Dynamic Objects in Magento with Varnish Cache is partial. This is due to the fact that dynamic elements depend on each user’s actions on your website. The aim is to make sure that the content of each customer’s cart will be unique. However, with Varnish Cache, you can control and improve the caching level of the dynamic elements on each page. These include the number of products in the user’s shopping carts or their value.

Varnish Cache Installation in Magento

How can you benefit from the advantages Varnish Cache offers? To improve your store’s performance, install the Varnish Cache extension. Then, configure the server to meet the technical configuration both servers need to respond to each user request on your website.

To be sure you have set up the extension to work properly with other caching solutions you already use for your Magento store, you may need to consult a Magento expert.

Keep in mind that Varnish Cache can be used together with the Magento default cache system. It also works great with other caching tools. This is to improve your website’s performance and offer the best shopping experience for your customers.

In the graphic below, you can see a performance comparison between different caching solutions in Magento:

magento cachingMagento Caching Solutions – Image Source:

CDNs – Content Delivery Networks

CDN Uses and Benefits

Implementing a Content Delivery Network with your Magento store will load the content faster for every customer that enters your website regardless of their location.

This means that your content will be provided to them more rapidly, as it is served from the CDN. The CDN system functions as shared web servers hosted in different locations worldwide. It is not served from your web server.

Additionally, by choosing to use a CDN, you can benefit from a more secure website, blocking harmful requests which attempt to steal the private data of your clients and may try to deny access to your entire website.

How CDNs works

Having a CDN can greatly improve the shopping experience of every customer around the world. For example, if your web server is located in the USA, then an image of a product you have in your Magento store will load faster for USA customers than for the customers outside the USA.

Content Delivery Network can make your website more responsive by delivering the same information to all customers around the world equally faster. It identifies each and every user’s location and serves the same information by accessing the closest web server available.

magento cdn
Content Delivery Network for Magento Users – Image Source:

To do this, a CDN makes a copy of, say, a product image, then distributes it to different web servers around the world. The CDN makes sure that regardless of the location a customer enters your website, the content is quickly loaded on your behalf. This translates into a higher transfer rate (throughput) for every static element on every webpage. It also reduces the latency rate for your website.

CDN works best for CSS files, JS files, and images. Using a Content Delivery Network in Magento will help your web store load these files more rapidly and simultaneously on a page. Much better compared to processing each and every file one by one by a single web server. This is usually the case in the absence of a CDN.

Using CDN with Magento

Keep in mind that for Magento, there is no full integration with a specific CDN. Making the right choice and the necessary settings to configure your CDN server is your responsibility. If you do not have the technical knowledge to integrate your Magento store with a CDN server on your own, we recommend you to ask for an expert’s assistance.

Another alternative is to use an extension, such as CloudFront CDN. It helps you configure your Magento store to use the Amazon CloudFront Content Delivery Network. Therefore, it will serve all the static files your store has, such as CMS Images, CSS files, and JS files. This alternative is simple to install and use. So no technical knowledge is required to have if you choose to use this option.

Merging CSS files and JavaScript files

Compressing CSS and JS files into a condensed file is another option you can choose to use in order to reduce the page load time on your Magento store and optimize the performance of your website.

Merging cascading style sheets and javascript files can significantly improve the page load rate of your Magento web store, as it compresses the original files so that the users who access your website will need to download less data and make fewer requests to your web server, which in turn will help you provide a more friendly browsing experience for them.

To merge CSS and JS files, go to the Admin panel and click “Stores.” In the settings section, select” Configuration” and then” Developer,” under the Advanced section on the left side of the page:

  •   To merge CSS files, go to the CSS files section and select the “Yes” option.
  •   To merge JS files, go to the JavaScript files section and select the “Yes” option.
  •   Finally, choose “Save Config.”

After enabling merging CSS and JS files, you will observe a reduction of CSS and JS file requests send to the server, as in the example below:

Magento Database Maintenance

Why is log cleaning necessary for a better performance?

Large databases can often decrease the loading time of your website, so managing your database by cleaning the logs can boost your site’s loading speed and reduce your latency rates in processing database queries, resulted after every search users make on your website, thus improving your website’s overall performance.

Magento databases save a lot of data in order to track down every order customers make so that every user can have access to view their shopping history, together with all their purchased products, and track down their orders in real-time.

By regularly cleaning your Magento store logs, your website will load faster and offer a better shopping experience for your customers.

Optimizing database log cleaning in Magento

E-commerce websites’ databases can benefit from a decreased size up to 75% and faster data processing after executing log cleaning operations, so optimizing your Magento database is one the most important tasks you need to consider to make your site perform better.

Although Magento has a built-in method to regularly clean the logging data, this option is not set by default so that every user can choose whether to turn it on and as is expected, most don’t.

Therefore you have to do it yourself, either automatically or manually, to benefit from more MySQL database space and boost your Magento database efficiency in processing all queries.

Before you proceed to log cleaning, it is recommended to do a backup, especially if you are not sure what data to clear up, as some information will be lost during this process, like specific data about your Magento website’s visitors.

How to automatically clean logs in Magento?

To optimize your Magento database log cleaning automatically, go to Admin, choose “System/Configuration,” and then in the left menu in “Advanced,” click on “System.” Set the “Log Cleaning” box to “Yes” and configure the “Save log” for 15 days. Then “Save Config.”

How to execute a manual log cleaning in Magento?

You can also choose to clean logging data much manually, and you can do it via directly accessing the database via a tool such as phpMyAdmin. This option is usually a faster way to clean the logs than by Magento built-in feature explained above, plus it gives you the opportunity to clean other tables that are not included in Magento’s default feature, such as:







By cleaning your logs, all the data contained in the selected tables will be consolidated, which will result in a decreased database size up to 95%.

To execute a manual log cleaning in Magento, go in phpMyAdmin to open the database, and in the right window, select the following table types:












Click the drop-down box situated at the bottom of the page and choose “Empty,” then click “Yes” on the confirmation window, and you’re all done. The selected logs are all cleaned up.

Enabling Flat Catalog

By default, Magento stores all catalog data in tables designed after the Entity-Attribute-Value (EAV) model, but because all product attributes are saved in many tables, SQL database queries can take a long time to respond and process the request, so the entire activity on your website will be slowed down.

Using a flat catalog can help you create new tables that are automatically updated and can be rapidly indexed to process all the information your Magento catalog contains and all your pricing policies details so that your store will perform better and benefit of reduces query complexity of database queries and also reduce the load on MySQL server.

The benefits can be observed more easily if you have a large number of products and categories, so the flat catalog feature will work better, especially if you have a big Magento web store.

To enable Flat Catalog feature in Magento, go to the “Admin” sidebar and click on “Stores.” Under the “Settings” section, choose “Configuration,” then choose “Catalog” from the panel displayed on the left side of the screen. Set “Use Flat Catalog Category” to “Yes” and “Use Flat Catalog Product” to “Yes” and, finally, “Save Config.”
magento flat catalog
Enabling Flat Catalog feature in Magento –

Using Magento Compiler

Magento Compiler is a default feature in Magento that allows you to compile all the installation files and create a single path for them in order to improve the performance of your website and increase the loading speed of your Magento store up to 10-20%.

The compilation option is designed to be used by Magento owners, especially if their website is running too slow, due to the big number of files the server needs to access on each request users make when visiting the store.

To use this tool, you should make sure the file” includes/config.php,” which can be found in the directory” includes,” must be writable.

Also, note that the Magento compilation feature should be disabled whenever you make any changes to your Magento installation files. When the changes you want to make are done, run the compilation process, and then enable the compiler again.

Using a hosting environment with PHP7

PHP7 is the latest version of PHP, and it offers significant performance benefits for both Magento 1 and Magento 2 websites. According to a recent study by MageCore, Magento 2 sites can almost double in performance by using PHP7 versus the previous PHP5 version:

Note however that Magento 1 isn’t compatible with PHP7 out of the box, but there are some extensions (such as this free one from Inchoo) out there that allow your store to run with minimum effort.


Improving your Magento’s site performance is more than a must if you want to keep ahead of your competition and increase your sales. Plus, having a fast loading website can help you increase your website’s ranking for every page of your store and offer a good user experience for your customers.

If you have any difficulties in improving your website’s performance based on the steps we presented in this guide, we advise you to seek assistance from experienced Magento developers! Improve your Magento performance with Magento performance optimization.

Do you want to improve your Magento’s website performance? Don’t wait – let’s talk today!

You may also be interested in