Memcached is a general-purpose distributed memory caching system. It is often used to speed up dynamic database-driven websites by caching data and objects in RAM to reduce the number of times an external data source must be read. It is mature technology, meaning that in the case of Amazon Linux you’ll find a yum repository enabling you to install and configure Memcached in a matter of minutes. And, it is equally easy to uninstall.
Memcached is so omnipresent that I actually struggled to find a good product description, and so please indulge me for a moment to share a few thoughts. Installing Memcached on your Linux server poses no risk, but it does provide potential for immediate improved performance, and so if you’re trying to decide whether or not to take the plunge, then I’m here to encourage you to press ahead. It does its work at a low level. For LAMP platforms you’ll see instructions below on how to associate a memcached instance with Php so that data objects are automatically stored, providing a noticeable performance improvement. Memcached does a good job of taking care of itself, and so you won’t need to worry about cache invalidations and such. Many of the tech industry’s biggest heavyweights use Memcached including YouTube, Reddit, Facebook, Pinterest, Twitter, Wikipedia, and others.
Memcached is an object cache, not a page cache. It does its work at a low level, near the bottom of your tech stack. What gets stored inside Memcached? In the case of a LAMP server, mostly instantiated Php objects that are good candidates for recycling. Fetching an already-existing object from the Memcached store is exponentially faster than recreating it from scratch, which requires multiple requests to both Php and MySQL services. Because of this, dynamic applications like Magento and Woo Commerce sites tend to greatly benefit from Memcached. The makers of Memcached made it possible to run Memcached on standalone servers so that an entire cluster of servers can leverage the same cache instance, greatly magnifying its performance improvement potential.
You might have experimented with site-based performance solutions like say, W3 Total Cache that provide an out-of-the-box object caching solution. None of these will be capable of matching the performance benefits of Memcached simply because they’re installed inside the application layer, near the top of your server stack.
In this tutorial we’ll install Memcached locally, and, we’ll integrate Memcached with Php so that applications like WordPress, Drupal, and Magento realize immediate benefit. Let’s get started!