Tuesday 23 August 2016

Introduction To Memcached

Memcached is a distributed memory object caching system. It is very fast in-memory cache.

How Memcached stores my data?
Memcached stores data in key-value format. You can assume it like a big hash table.

What Operations can I perform on Memcached?
You can perform following operations.
         a. You can insert new <key, value> pair.
         b. You can get the value associated with given key.
         b. You can delete an entry associated with a key.

How exactly Memcached works?
It has a client software, which is aware of list of Memcached servers, apply some hashing algorithm on key to choose a server. Once the server identified, it stores the information into specific server. Memcached server stores information in <key, value> pair format.

Key components of Memcached
There are two key components in Memcached.
a.   Client
b.   Server

Client
Client applies hashing algorithm on key and identifies the server. Once it identifies the server, client can perform read/write operations. Cliene knows what to do when it cannot contact a server.

Server
Server responds to client requests and manages when to evict or reuse memory.

Are Memcached servers aware of each other?
No, Memcached servers are unaware of each other. Only clients aware of servers. Adding servers increases the available memory.

What is the time complexity to perform operations?
Memcached perform all CRUD operations in O(1) time.

What is the default algorithm used to remove elements from cache, when cache is full?
Memcahed use Least Recently Used (LRU) algorithm by default. Once the cache is full, least recently used keys will be removed.

Is there any expire time for keys in Memcached server?
Yes, items expire after a specified amount of time.

Who are using Memcached?
Now a days most of the dynamic web applications are using Memcached. it is used by Facebook, Twitter, Reddit, Youtube etc.,



Previous                                                 Next                                                 Home

No comments:

Post a Comment