0 votes
in MemCached by

Memcached has four main components and these components are what allow it to store and retrieve data. Each item is comprised of a key, expiration time, and raw data. At a high-level Memcached works as follows:

  • The client requests a piece of data then Memcached checks to see if it is stored in cache.
  • There may a possibility of two possible outcomes:
    • If the data is stored in cache: return the data from Memcached (there is no need to check the database).
    • The data is not stored in cache: query the database, retrieve the data, and subsequently store it in Memcached.
  • Whenever information is modified or the expiry value of an item has expired, Memcached update its cache to ensure fresh content is delivered to the client.

This setup has various Memcached servers and many clients. Clients use a hasing algorithm to determine memcahed storage server for use. This helps to distribute the load.

And then server computes a second hash of the key in order to determine where it should store the corresponding value in an internal hash table. Some important things about Memcached architecture are:

  • Data is only sent to one server
  • Servers don't share data
  • Servers keep the values in RAM - if RAM runs out the oldest value is discarded.

Related questions

0 votes
asked Jun 9, 2020 in MemCached by DavidAnderson
0 votes
asked Jun 9, 2020 in MemCached by DavidAnderson
...