Portal Home > Knowledgebase > Magento > Optimise Magento - Increase Magento Speed
Optimising Magento Performance
This is a guide for optimizing Magento performance. Most optimizations can be performed on any version of Magento. Those intended for specific versions and newer will be indicated.
The default .htaccess file that comes with Magento has several sections dealing with performance. These configurations are commented out and will need to be turned on to realize their benefit.
This section will turn on the apache mod_deflate module, which compresses text, css, and javascript before it is sent to the browser. This results in a smaller download size. To enable, simply uncomment the appropriate lines so that it looks like the following:
############################################ ## enable apache served files compression ## http://developer.yahoo.com/performance/rules.html#gzip # Insert filter on all content 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-varyEnable Expires Headers
NOTE: This does not work on Litespeed servers.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:
############################################ ## Add default Expires header ## http://developer.yahoo.com/performance/rules.html#expires ExpiresActive On ExpiresDefault "access plus 1 year"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 noneMagento Admin Tweaks
There are a couple of features that can be enabled in the back end of Magento to optimize performance. Generally, these features are available on versions 1.4.0.1 and higher and should be performed when most of the development work is done.
Combine CSS and JS Files
This feature reduces the number of HTTP requests. For versions earlier than 1.4.x, the Fooman_Speedster extension can be used instead.
In the Magento Admin, go to System > Configuration > Developer. Under "Javascript Settings", change "Merge Javascript Files" to YES. Under "CSS Settings", change "Merge CSS Files" to YES. Clear the cache.Enable Flat Catalog
Magento uses the EAV model to store customer and product data. This enables these objects to be incredibly extensible, but results in longerSQL 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. Stores with over 1000 products should enable Flat Catalog for Products.
In the Magento Admin, go to System > Configuration > Catalog. Under "Frontend", change "Use Flat Catalog Category" to YES. Under "Frontend", change "Use Flat Catalog Product" to YES. (optional) Clear the cache.
Add to Favourites
Print this Article