Magento has been named a resource hog. If you have a server which isn’t able to handle Magento, the site can run a little sluggish. We cannot say this enough, “Get good, sufficient hosting.” However, there are measures a Magento developer can take to help improve performance.

1. Enable Flat Categories and Products

In the Magento admin, navigate to System > Configuration > Catalog > Catalog > Frontend. Set “Use Flat Catalog Category” and “Use Flat Catalog Product” to “Yes”.

Pic 1

See Mage_Catalog_Model_Resource_Product_Collection class below. By doing this setting, you are adjusting how Magento pulls categories and products. It will now pull from the Flat Resource while making the SQL queries simpler.

Pic 2

2. Merge and compress JS and CSS

The following extensions can to compress JS and CSS

We don’t recommend using the built-in JS and CSS merger, because it causes more problems than good.

An excerpt from the article above:

“Magento collates all of the XML layout files and determines which Javascript files should be included for the homepage request. These files are then merged into a single file and saved using an md5 hash of their filenames. This new file, named f0eb853c09ba3e46ad21fb89b8d57626.js, is then served to the user, who downloads it and stores it in their browser cache.

Next, the user clicks a link to one of your categories. Once again, Magento collates the XML layout files and determines what Javascript files are needed for the category page. At this point, Magento realises that the exact same Javascript files used on the homepage are needed on this page.

Instead of remaking the single Javascript file, Magento serves the Javascript file created when the user visited the homepage. This time though, the browser knows that it already has this file and therefore doesn’t download it again. Instead, the file is loaded from the user’s cache, saving time, bandwidth and computer resources!

So far everything has gone well; we have made the page load faster while decreasing the load on the server, but… Next, the user is enticed by one of your products and clicks through to a product page.

Once again, Magento determines which Javascript files are needed based on the layout XML files. At this point, Magento realises that the same Javascript files on the homepage are needed as well two new files. As a merged file containing this combination of Javascript doesn’t exist, Magento merges the files and creates a new Javascript file named 139f9771ba2ba0cae754978fab4a3c35.js.

Roughly 80% of this file is the Javascript that was used on the homepage and has been downloaded and cached by the user already. The final 20% accounts for the new Javascript files used solely on the product page. This file is then served to the user who is forced to download it all! Although this file is made of 80% code that has already been cached, the user’s browser is completely unaware of this and will download 100% of the file and cache it again!”

When moving JavaScript files to the footer, use this extension.

3. Enable Full Page Cache (FPC)

If you are on Community Edition, use one of the extensions below

Enable other caching

  • Cache backends: Memcache or APC
  • Session stores: Memcache or Redis
  • OpCode cache: APC or XCache
  • Reverse Proxy Cache: Varnish