Most modern websites are dynamic in nature. They are updated on the fly, rely on database backends and often feature some type of support for user interaction. While those aspects of dynamic websites are all positive, the negative side is that they require more system resources, especially memory. A more resource-intense web application can slow down your server and make user experiences less pleasant. Memcached is a tool that is designed to help alleviate some of those slow downs.
Based on its website’s own description, Memcached is defined as a, “Free and open source, high-performance, distributed memory object caching system”. Memcached lifts some of the strain on servers by storing small chunks of frequently accessed data in memory to speed up page rendering.
To install memcached on Red Hat Enterprise Linux or CentOS, you need the following packages:
The first step is to enable RHEL EPEL repository. In CentOS 6, for example, you would run the following commands:
sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
You should then check /etc/yum/repos.d/remi.repo to make sure it is enabled.
Next, install the packages:
yum install memcached php-pecl-memcache memcached-selinux
Finally, you will need to configure memcached according to your preferences. You can see an example here and read the full documentation here. After configuration Memcached will be ready to lighten the load on your server.