Making Magento run faster configuring Redis as back-end
About Neev
Web
Mobile
Magento eCommerce
SaaS Applications
Video Streaming Portals
Rich Internet Apps
Custom Development
iPhone
Android
Windows Phone 7
HTML5 Apps
Cloud
AWS Consulting Partner
Rackspace
Joyent
Heroku
Google App Engine
Key Company Highlights
250+ team with experience in
managing
offshore, distributed
development.
Neev Technologies
established in Jan ’05
VC Funding in 2009 By Basil
Partners
User Interface Design and User Experience Design
Part of Publicis Groupe
Member of NASSCOM.
Performance Consulting Practices
Development Centers in
Bangalore and Pune.
Quality Assurance & Testing
Outsourced Product Development
Offices at
Bangalore, USA, Delhi, Pune,
Singapore and Stockholm.
The Caching Method Currently Employed in Magento
• Magento uses the default two level caching of the Zend
framework, a fast cache and a slow one as configured in the file
Local.xml
• The fast cache is configured to APC/Memcache, whereas the
slow one is file system based
Advantages and Disadvantages of Default Cache
•
Magento stores its cache entries in the file system. This model does have an advantage.
We don’t need any additional software to keep it running
•
The default model, however, proves to be more of a disadvantage than an advantage.
This is because Magento stores its cache entries in the file system in the /var/cache
folder. This is fine as long as the traffic is minimal. The Magento cache is also organized by
tags, this means you have cache entries which belongs to a cache group
•
Once the traffic increases, the number of cache entries in the file system increase, and
reading and writing to the file system becomes slower and slower
•
Magento clears cache entries by tag. A typical scenario is one where, after placing an
order or saving a product, it makes sure that the block caches are updated on the store.
While clearing entries by cache tag, Magento has to open each file to check if the cache
entry belongs to the cache group
•
Consider a Magento store with 1000 products, it would have a cache size of 50 MB. There
would be at least 3500 entries(individual files) and the process would be very slow and
certainly not feasible in the long run
2 Ways of Achieving Better Performance in this Model
1. Use SSDs( Solid State Drives) instead of normal hard drives
2. Put the /var/cache directory in tmpfs
Advantages of Configuring Redis as Back-End
• Very fast cache back end with excellent support for cache tags, the slower
file system cache is ruled out
• Highly recommended in multi-server environments where you have more
than one web server
• It has been tested on high traffic Magento stores with more than 500,000
visitors / day and the performance has been great
Requirements for a Working Redis Back-End
• Redis must be installed on the server.
• PHP Extension PHPRedis must be installed.
• Magento extension “Cm_Cache_Backend_Redis” must be installed.
Installation and Configuration For Redis : Initial Steps
1. Install redis(2.4+ required)
2. Install phpredis
3. Install the magento extension “Cm_Cache_Backend_Redis”
4. Edit your app/etc/local.xml. Follow screenshot below :
Installation and Configuration of Redis : Final Step
Restart the PHP process and it will make sure the cache is being stored in Redis as shown
below :