Database Reference
In-Depth Information
Introduction to memcached
Memcached is a very simple in-memory key value store; we can assume it to be an in-
memory store for a hash map. This can be used in conjunction with Storm supervisors to
serve as a common memory storage, which can be accessed for read/write operations by all
the Storm workers on various nodes in the Storm cluster.
Memcached has the following components:
• The memcached server
• The memcache client
• The hashing algorithm (client-based implementation)
• The server algorithm for data retention
Memcached uses Least Recently Used ( LRU ) to discard the elements from the cache. This
means that the items that have not been referred since the longest time are the first ones to
be removed from the cache. These items are said to be expired from the cache, and if they
are referred after expiry, they are reloaded from a stable storage.
The following is the flow of how entries are loaded and retrieved from or through a cache:
The preceding figure depicts the scenarios of cache hit and cache miss, where certain items
expire as per the LRU algorithm. The scenarios in the preceding figure are as follows:
• When the cache app location starts, it's loaded with the data from the stable stor-
age, in our case, from the database
• There are two scenarios that can happen in a situation where we request the data
from the cache:
Cache hit : This is where the data we request exists on the cache server
and in this case, the request is served from the cache
Search WWH ::




Custom Search