Memcached Flashcards
Characteristics
Distributed key-value store (hashtable)
Limited size – key,value pairs are discarded when cache is full
* Cache eviction policy: LRU (least-recently used).
* More details: cache divided in HOT, WARM and COLD; new
items enter the HOT; cache eviction moves object to the
lower level.
Designed for
- High-throughput servers – accessing memory is much faster
than disk. - High-latency queries – avoid repeating costly queries.
Architecture
- Clients know about all servers.
- Clients know the hash function to assign a key to a server.
Can use consistent hashing. - Clients send operations to the server that will hold a given
key directly. - Servers maintain a “key-value” store.
Memcached limitations:
On a cache miss, multiple clients may end up trying to set the
value of a cache entry.
For a value updated very frequently, writes may be reordered
and the old value get written in the cache.
Solution [from Facebook]:
* Clients get leases for writing the value of a key. This
guarantees that a single client writes at a time.
Memcached Limitations: No Replication