liveBook · Manning

Distributed caching

As explained in Grokking Software Architecture

A distributed cache is a cache whose stored data is shared across multiple networked processes or machines.

A distributed cache is a shared place to keep expensive database-query results. Application servers can reuse cached answers instead of repeating the work; Redis is one example. section 10.6

A faster homepage

Run a heavy homepage query once and keep its result in Redis for five minutes. Later visitors can get the cached answer, reducing repeated database work and potentially easing the load on the servers. section 10.6

A local L1 cache can avoid the network trip to a shared L2 cache, but it adds a synchronization problem: if a server misses an update, users may see stale data, such as an old profile picture on one page and a new one on another. section 10.6

Figure 10.8 Multi-Level Caching: The Local Cache (L1) is like a personal sticky note for blistering speed, while the Distributed Cache (L2) is a shared whiteboard for the entire system.

Compare the local L1 cache with the shared distributed L2 cache. section 10.6

How Grokking Software Architecture covers it

How deep it goes
Explains shared-cache use and L1/L2 tradeoffs, including stale-data risk, but does not detail invalidation mechanisms.
Examples
Uses a homepage query cached for five minutes and compares local memory with a shared Redis whiteboard.
What you can do after
Apply a shared Redis cache to reuse expensive query results and reduce redundant processing.
How it connects
Connects distributed caching to Redis, database queries, horizontal scaling, and multi-level caching.

Also explained in

Compare how 5 books explain distributed caching →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Grokking Software Architecture. The section links point to the parts of the book it draws on.