92014Aug

Magento Optimization – Part 1

Whenever it comes to online shopping a fast experience to your customers is essential. Research has shown that that website abandonment happens after 3 seconds and that faster sites earn more revenue.

Simply put, a slow site=slow sales. Even a 1-second delay in page load time can potentially cost you millions in revenue.

Keeping this in mind we will go through some of the ways by which we can optimize a Magento site using different techniques. First of all lets talk about caching.

By default, Magento stores its cache entries in the file system. You can find the cache in var/cache/. This cache back-end is fine for small websites with a small cache size. As you get more requests from visitors, reading and writing to the file system gets slower and slower as the cache grows. This is the default caching mechanism when no other caching options are enabled.

Magento uses the default two-level caching of Zend framework. It is configured in the local.xml file of Magento. While one cache will be used as a first level cache and the second will be used as a second level cache. So when the caching is enabled in the local.xml file, everytime Magento needs to cache data, it will save data in both the first and second level cache. Later on, whenever Magento will need to fetch something from the cache, it will first look in the first level cache, and if it doesn’t find it, it will try to get it from the second level cache. If it was found in the second level cache, it will save it again in the first level cache. Naturally, the first level cache should be faster then the second level cache. Thus, in Magento the first level cache is called the "fast backend" and the second level cache – the "slow backend". Below it's shown how Magento fetches data from the cache.

Magento Caching

Magento allows these 4 caches to be used as fast backend – Apc, memcache, xcache and eaccelerator. And as a slow backend either the file system or the database is used. The common two-level cache setups are Apc-filesystem, memcached-filesystem, Apc-database and memcached-database.

In the next blog we will discuss in detail about how to implement the APC and Memcached caching mechanism.