Memcached is a simple, yet highly-scalable key-based cache that stores data and objects wherever dedicated or spare RAM is available for very quick access by applications. To use, you run memcached on one or more hosts and then use the shared cache to store objects.Because each host’s RAM is storing information, the access speed will be much faster than having to load the information from disk. This can provide a significant performance boost in retrieving data versus loading the data natively from a database. Also, because the cache is just a repository for information, you can use the cache to store any data, including complex structures that would normally require a significant amount of effort to create, but in a ready-to-use format, helping to reduce the load on your MySQL servers.
To install memcached on a RedHat, Fedora or CentOS host, use yum:
# yum install memcached
To install memcached on a Debian or Ubuntu host, use apt-get:
# apt-get install memcached
To install memcached on a Gentoo host, use emerge:
# emerge install memcached
To install on OpenSolaris, use the pkg command to install the
# pkg install SUNWmemcached
You may also find memcached in the Coolstack project. For more details, seehttp://cooltools.sunsource.net/coolstack/.
On other Unix-based platforms, including Solaris, AIX, HP-UX and Mac OS X, and Linux distributions not mentioned already, you will need to install from source. For Linux, make sure you have a 2.6-based kernel, which includes the improved
epoll interface. For all platforms, ensure that you have
libevent 1.1 or higher installed. You can obtain
libevent web page.
You can obtain the source for memcached from memcached website.
To build memcached, follow these steps:
Extract the memcached source package:
shell> gunzip -c memcached-
1.2.5.tar.gz | tar xf -
Change to the memcached-
shell> cd memcached-
Some additional options you may want to specify to configure:
If you want to specify a different installation directory, use the
shell> ./configure --prefix=/opt
The default is to use the
If you have installed
libeventand configure cannot find the library, use the
--with-libeventoption to specify the location of the installed library.
To build a 64-bit version of memcached (which will allow you to use a single instance with a large RAM allocation), use –enable-64bit.
To enable multi-threading support in memcached, which will improve the response times on servers with a heavy load, use
Run make to build memcached:
Run make install to install memcached:
shell> make install
Also ReadÂ configuration parameters of memcached