Skip to content
StackDecode
System Design
7. Caching ArchitectureAnimated

Redis

An in-memory data store with rich data types.

The idea

Redis supports strings, hashes, lists, sets, sorted sets and streams, with optional persistence and replication.

Watch it work

Press play, pause, or step through. Some animations have settings you can change.

RequestL1 in-processL2 RedisDatabase
  • client
  • gateway / proxy
  • service
  • cache
  • data store
  • queue / stream

Check the in-process cache: nanoseconds.

step:
1/4
at:
Request
1/10

The green dot is a request moving through the system.

Step by step

  1. 1Client connects
  2. 2Sends commands such as GET and SET
  3. 3Redis serves from memory
  4. 4Optionally persists to disk

Where it is used

Caching, rate limiting, queues, leaderboards.

Watch out for

Single-threaded commands, so big values and slow commands block everyone.

Related