Week 15 — Real HLD Questions & Redis

advanced hld dbms dsa python

Goal: Time to practice real system design questions — the ones actually asked in interviews. This week you stop learning theory and start designing systems end-to-end.

Topics

DayFocusTopics
MonHLD — URL Shortener & Rate LimiterDesign a URL Shortener · Design a Rate Limiter
TueHLD — Chat & Social FeedDesign a Chat System · Design a Social Media Feed
WedRedis & CachingRedis Persistence · Caching Patterns
ThuDBMS Scaling & DSAReplication · Sharding · Interval and String DP
FriDSA & PythonDP on Trees and Graphs · Context Managers · Pythonic Code and PEP 8

Key Concepts

  • URL shortener — base62 encoding, read-heavy workload (~100:1 read-to-write), key generation service
  • Rate limiter — token bucket vs sliding window log vs sliding window counter, where to place it
  • Chat system — WebSocket for real-time, message queue for reliability, presence/online status
  • Social media feed — fan-out on write (push) vs fan-out on read (pull), celebrity problem
  • Cache-aside vs write-through vs write-behind — pick the right pattern for your access profile
  • RDB vs AOF persistence — RDB for snapshots (faster recovery), AOF for durability (less data loss)
  • Leader-follower replication — read replicas, replication lag, and failover promotion
  • Sharding strategies — hash-based vs range-based, resharding pain, consistent hashing
  • Python context managers — with statement, __enter__/__exit__, contextlib shortcuts
  • PEP 8 essentials — naming conventions, line length, imports order, and when to break the rules

Practice

  • Whiteboard a full URL shortener design in 30 minutes — requirements, API, storage, and scale estimates
  • Explain the cache-aside pattern with code — show the read and write paths clearly
  • Write a Python context manager for database connections (both class-based and @contextmanager)
  • Solve a longest common subsequence problem using interval DP

~12 topics · ~1.5-2 hrs/day · Focus: read the linked notes, then code each concept