...

/

System Design: The Distributed Cache

System Design: The Distributed Cache

Learn the basics of a distributed cache.

Problem statement

A typical system consists of the following components:

  • It has a client that requests the service.
  • It has one or more service hosts that entertain client requests.
  • It has a database used by the service for data storage.

Under normal circumstances, this abstraction performs fine. However, as the number of users increases, the database queries also increase. And as a result, 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 retrieves data from the cache (cache hitWhen the requested data is found in the cache, the server responds with the data immediately.) and serves the user. However, if the data is unavailable in the cache ( ...