Command Palette

Search for a command to run...

Hectal
Phase 15Advanced16 of 17 in Redis

System Design with Redis

The pattern catalogue and the anti-patterns, then staff-level designs: analytics, feeds and timelines, driver location, recommendation caches, API gateways, notifications, schedulers, and a full e-commerce capstone.

Everything so far comes together here. Each design follows the reasoning chain interviewers look for: requirement → scale → consistency needs → data structure → Redis primitive → atomicity → failure behaviour → scaling → observability → trade-offs.

The goal isn't to put Redis everywhere. It's to decide precisely where it belongs, what role it plays, and what happens when it's slow or gone.

0/7 · 0%
7 topics ~58 min 9 code blocks & diagrams
Start with the first topic
1
15.1

The Redis Pattern Catalogue and Anti-Patterns

About thirty named patterns cover almost every Redis design: caching (aside, through, behind, double delete, warming, stampede, penetration, avalanche, negative, multi-level, near-cache), coordination (locks, fencing, idempotency, dedup, leader lease), counting and limiting, queues and scheduling, leaderboards, sessions, pub/sub and streams. Equally important are the anti-patterns that cause most Redis incidents.

8 min 1 diagram practice

2
15.2

Real-Time Leaderboards and Analytics

Real-time analytics combine Redis primitives: streams for ingest, counters and hashes for totals, sorted sets for rankings and time windows, HyperLogLog for uniques, bitmaps for activity, and time-bucketed keys with TTLs, with durable aggregates flushed to a warehouse.

8 min 1 code practice

3
15.3

Feeds and Timelines: Instagram and Twitter

Timelines are built by fan-out on write (push post IDs into followers' timeline caches), fan-out on read (merge followees' recent posts at read time), or a hybrid that pushes for normal users and pulls for celebrities. Redis holds per-user timeline caches as capped sorted sets or lists of post IDs.

9 min 1 diagram 1 code practice

4
15.4

Uber-Style Driver Location

Driver location is a high-write, short-lived dataset: GEO sets per geographic cell for search, TTL-based freshness tracking, a lock or atomic claim for assignment, and regional sharding. It needs no durability; it regenerates every few seconds.

7 min 1 code practice

5
15.5

Recommendation Caches and API Gateways

A recommendation cache precomputes per-user results and serves them from Redis with TTLs, warming and fallbacks; an API gateway uses Redis for rate limits, session and token checks, idempotency and response caching. Both are exercises in key design, hot keys, failure behaviour and cost.

8 min 1 diagram practice

6
15.6

Notification Systems and Distributed Job Schedulers

A notification system combines a durable event log (Kafka or Streams), per-user preferences and rate limits in Redis, deduplication, delayed delivery with sorted sets, and real-time push via Pub/Sub to WebSocket servers. A distributed scheduler combines sorted sets, streams, locks and idempotent workers.

8 min 1 diagram practice

7
15.7

Capstone: A Distributed E-Commerce Platform

Put it all together: an e-commerce platform where Redis provides the product cache, sessions, carts, atomic inventory holds, payment idempotency, gateway rate limiting, order event streams, notifications, product rankings, unique visitors, nearby warehouses, scheduled jobs, and cache protection, on replicated, persistent, monitored clusters, with PostgreSQL and Kafka as sources of truth.

10 min 1 diagram 1 code practice