Memcached is a high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load.
Memcached is a generic purpose distributed high performance memory object caching system to use in speeding up dynamic database driven websites by caching data and objects in memory to reduce the amount the database needs to be read. Memcached was originally developed by Danga Interactive for LiveJournal but is now used by many popular and large community driven websites like Slashdot, Wikipedia, SourceForge, Facebook and like. It is being distributed under a permissive free software licence.
How it works
At heart it is a simple Key/Value store. Memcached is an in-memory key-value store for small chunks of arbitrary data (strings, objects) from results of database calls, API calls, or page rendering.
Memcached consists of a server and a client part. The server is a standalone program that runs on your servers and the client is in this case a PHP extension.
Memcached server has a memory limit. It will never consume more memory than the limit. If the limit is exceeded, older cache is automatically thrown out (if the TTL is exceed or not).
What to cache?
Caching is NOT a part of each system. It is a tool for increasing the performance and a loading capabilities.
You can cache almost everything. You must monitor your system and find bottle-necks before deciding what to cache.
More often caching is utilized in the following cases:
- Results of qieries to a external services (RSS, SOAP, REST, Facebook API, etc)
- Results of queries to database
- Generated/Compiled templates (if using template engines)
- Generated pages or part of pages
- Results of work of complicated algorythms, if the logic allows the results to be inacurate in time.
What’s the difference between memcache vs. memcached?
Where to get Memcached ?
* Memcached – http://memcached.org/
* CouchBase
http://www.couchbase.com/products-and-services/memcached – Binaries available for Windows and Red Hat and Ubuntu Linux.
Memcached is part of Membase Server, transparently caching data in front of its key-value database. You can configure Membase Server to provide only Memcached services. Membase Server is the lowest latency, highest throughput NoSQL database technology.
Memcached with Linux
Read this post “Installing and Using Memcached for PHP on Ubuntu“.
Memcached with Windows
Read this post “Memcached with Windows“.
One thought on “Memcached Overview”