Magento optimization

Magento optimization

Magento optimization – There are several steps you might consider in order to improve your Magento website performance. Based on our experience we can recommend the following points to optimize your Magento store.

It is a good idea to keep your Magento application up to date. New releases usually include performance improvements and other patches that can greatly reduce your Magento website loading speed.

This guide demonstrates how to optimize Magento performance. Most optimizations will work with any version of Magento. Those intended for specific versions will be indicated as such.

Enable Magento Output Compression

This section will turn on the apache mod_deflate module, which compresses text, css, and javascript before it is sent to the browser. Enabling gzip compression in Magento is a very easy process that just requires a slight modification to the .htaccess file located in the html document root (~/public_html/.htaccess).

By default, Magento includes the required lines to enable gzip compression, but they are disabled:


## Insert filter
#SetOutputFilter DEFLATE
## Insert filter on selected content types only
#AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
## Netscape 4.x has some problems…
#BrowserMatch ^Mozilla/4 gzip-only-text/html
## Netscape 4.06-4.08 have some more problems
#BrowserMatch ^Mozilla/4.0[678] no-gzip
## MSIE masquerades as Netscape, but it is fine
#BrowserMatch bMSIE !no-gzip !gzip-only-text/html
## Don’t compress images
#SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
## Make sure proxies don’t deliver the wrong content
# Header append Vary User-Agent env=!dont-vary

To enable gzip compression for your Magento store, simply change the above lines as follows:


## Insert filter
SetOutputFilter DEFLATE
## Insert filter on selected content types only
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript
## Netscape 4.x has some problems…
BrowserMatch ^Mozilla/4 gzip-only-text/html
## Netscape 4.06-4.08 have some more problems
BrowserMatch ^Mozilla/4.0[678] no-gzip
## MSIE masquerades as Netscape, but it is fine
BrowserMatch bMSIE !no-gzip !gzip-only-text/html
## Don’t compress images
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|png)$ no-gzip dont-vary
## Make sure proxies don’t deliver the wrong content
Header append Vary User-Agent env=!dont-vary

Magento Enable Expires Headers

Browsers use Expires headers to determine how long a page component can be cached. Static components, like images, should have far-future expires headers, but truthfully, all page components should have expires headers. To turn this feature on, just uncomment the appropriate line and add “ExpiresActive On” right above it. See below:


ExpiresActive on
ExpiresDefault "access plus 2 days"

Disable ETags

ETags are a way for browsers to validate cached components across subsequent visits. They can slow down a site served from a cluster if the cluster hasn’t implemented them properly. It is best to just turn them off as follows:


## If running in cluster environment, uncomment this
## http://developer.yahoo.com/performance/rules.html#etags

FileETag none

Now, from Magento admin side make sure that you combine JS and CSS files.

  • Magento admin -> System Configuration -> Developer -> Under “Javascript Settings”, change “Merge Javascript Files” to YES.
  • Magento admin -> System Configuration -> Developer -> Under “CSS Settings”, change “Merge CSS Files” to YES

Clear Magento cache.

Use CDN if it is possible, please note combining CSS/JS when using CDN will cause CSS/JS to “break” until the CDN updates completely.

Enable Magento Flat Catalog

If your Magento store has a large number of products you might consider enabling the Flat Catalog module for products and categories. Magento uses the EAV model to store customer and product data. This enables these objects to be incredibly extensible, but results in longer SQL queries and more reads. Enabling the Flat Catalog for Categories and Products merges product data into one table, thereby improving performance. Generally, all stores should enable Flat Catalog for Categories.

This can be done via your Magento Admin panel -> Configuration -> Catalog

Was this article helpful?

Related Articles

Leave A Comment?