This is the first blog of “Staying 2 Steps Ahead of the Performance of Your Magento Site,” a series of five entries from Hostway partner Cynch, an expert on optimization and a leading migration and IT management agency.
E-commerce sites on the web are expected to be blazing fast, and the average online consumer is getting more impatient by the day. They assume online vendors not only emphasize user experience and security, but also ensure data delivery within a second or two per click. While Magento is a great e-commerce solution, it’s not known for its speed.
Enter, stage left: memcache. memcache is an object-caching service that’s entirely memory-based. It exposes a TCP-based interface to store and retrieve any key-value pair of data. It’s very stable and very fast, and even better, Magento can use it out of the box.
There are three things you’ll need to do to allow your Magento deployment to utilize memcache:
- Install the daemon (or service);
- Install the required client libraries;
- Configure your Magento deployment to use memcache for object caching.
If your hosting provider doesn’t already have a “Magento Optimized” hosting package – which should always include the daemon and the client libraries for memcache – then you have a little to do before Magento can cache stuff.
Installing the service, or memcached, requires either finding the packages for your OS or compiling and installing it from scratch. As I write this post, the latest version of memcached is 1.4.20. Most Linux distributions currently include memcached in their package repositories, so sometimes it’s as easy as using apt or yum to get the packages installed. If you’re hardcore and want to compile it manually, doing so is really simple:
tar -zxvf memcached-1.x.x.tar.gz
./configure && make && make test && sudo make install
When you’re ready to install the client libraries, you may face a decision on which implementation of the PHP client libraries to install: pecl-memcache or peck-memcachd. To make your life easier, just install them both; most hosting providers will do so when deploying their optimized solutions. You’ll find that stable Linux distributions will likely not include the PHP extensions for memcache (php-pecl-memcache or php-pecl-memcachd) in their stock distributions, but externally managed distributions include them. Again, if you’re hardcore or prefer to manage your Pear and Pecl modules outside of your OS’s package manager, you can use pecl to install either package also.
Once you have all of your prerequisites available to you, the last step is to configure Magento to store and retrieve objects in memcache. Open up your app/etc/local.xml file and find the <cache> directive. Recent versions of Magento provide wonderful examples of how to specify memcache be used as the caching backend rather than file-based caching.
The last step before you can enjoy a turbocharged Magento site is to make sure you haven’t disabled caching within Magento’s admin interface. Go to System -> Cache Management and make sure nothing is set to Disabled. I can’t count the number of times I’ve had customers complain that their sites are still slow swearing that they have everything configured properly only to find that they have caching disabled within the admin.
Now, go and enjoy your faster website, happier customers, and hopefully, your e-commerce riches.
Cynch Inc. and Hostway have teamed up to put together a fully optimized solution for your Magento store for which caching is only one for the many tricks we have up our sleeves. Stay tuned over the next few weeks for more tips on how you can tune up your website to work more efficiently.
Also, don’t forget to catch our live webinar at the end out this series, “Staying Two Steps Ahead of the Performance of Your Magento Site,” where one of our techs will show you how it all comes together.
For more information regarding Hostway’s Magento stack, or how to optimize your existing environment to complement your business, contact your Hostway representative or Cynch Inc. directly at www.cynchinc.com/design/contact.html.