...

/

Introduction to Distributed Cache Clone

Introduction to Distributed Cache Clone

Learn the basics of distributed caches and understand the fundamentals for designing a distributed cache.

Problem statement

A typical system consists of the following components:

  1. A client requesting the service.
  2. Service host(s) entertaining client requests.
  3. A database used by the service for data storage.

Under normal circumstances, this abstraction performs fine. However, as the number of users and, therefore, the database queries increase, the service providers are overburdened resulting in slow performance.

In such cases, a cache is added to the system to deal with performance deterioration. A cache is a temporary data storage that can serve data faster by keeping data entries in memory. Caches store only the most frequently accessed data. When a request reaches the serving host, it will retrieve data from the cache (cache hitwhen the requested data is found in the cache, the server responds with the data immediately.) and serve the user. However, if the data is not available in the cache (cache missWhen the requested data is not found in the cache, it is called a cache miss.), the data will be queried from the database. Also, the cache will be populated with the new value to avoid cache misses for the next time.

A cache is a non-persistent storage that is used to keep repeatedly read/written data to provide the end-user with lower latency. Therefore, a cache must serve data from a storage component that is fast, has enough storage, and is affordable in terms of dollar cost as we scale the caching service. The following illustration highlights the suitability of RAM as the raw building block for caching.

As we progress in this lesson, we will understand what a distributed cache is and why do we need one. Because data is written to cache and databases, the order in which data writing happens has performance implications. We, therefore, discuss various writing policies next. We also explain different policies that we will use to evict less-frequently accessed data in the distributed cache. Since cached data may get outdated, we formulate cache invalidation methods next. We further discuss the library called cache client which will send requests to the cache servers. Before concluding our lesson, we explain different mechanisms of data storage on the cache.

What is a distributed cache

A distributed cache is a caching system where multiple cache servers coordinate to store frequently accessed data. Distributed caches are needed in environments where a single ...

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy