🌍 System Design · subject

System Design Distributed System Components Syllabus

The Distributed System Components syllabus for System Design in full: 6 chapters and 22 topics, every one listed below, plus 52 Distributed System Components flashcards with answers.

6Chapters
22Topics
52Flashcards

Distributed System Components syllabus: all 6 chapters

Expand any chapter to see its topics and sub-topics.

  1. Load Balancing

    4 topics
    • Layer 4 vs Layer 7 Load Balancing
    • Load Balancing Algorithms
    • Health Checks and Failover
    • Global Server Load Balancing
  2. Caching

    4 topics
    • Cache Eviction Policies
    • Caching Strategies
    • Distributed Caching with Redis and Memcached
    • Cache Invalidation and Thundering Herd
  3. Content Delivery Networks

    3 topics
    • Edge Caching and PoPs
    • Push vs Pull CDNs
    • Cache-Control Headers and TTL
  4. Message Queues and Streaming

    4 topics
    • Point-to-Point vs Pub/Sub
    • Apache Kafka Architecture
    • RabbitMQ and AMQP
    • Delivery Guarantees and Backpressure
  5. Proxies and Gateways

    3 topics
    • Forward vs Reverse Proxy
    • API Gateway Responsibilities
    • Rate Limiting and Throttling
  6. Coordination Services

    4 topics
    • Distributed Consensus
    • Leader Election
    • Distributed Locking with ZooKeeper and etcd
    • Service Discovery

System Design Distributed System Components flashcards — 52 questions with answers

  1. At which OSI layer does an L4 load balancer operate, and what does it use to make routing decisions?

    It operates at the transport layer (Layer 4) and routes based on network information — source/destination IP addresses and TCP/UDP ports — without inspecting packet payloads.

  2. At which OSI layer does an L7 load balancer operate, and what added routing capabilities does this give it?

    It operates at the application layer (Layer 7) and can inspect HTTP content — URLs, headers, cookies, methods — enabling content-based routing, SSL termination, and sticky sessions.

  3. Give one key performance/functionality trade-off between L4 and L7 load balancing.

    L4 is faster and cheaper (no payload inspection, lower latency, higher throughput) but 'dumb'; L7 is slower and more CPU-intensive but supports smart, content-aware routing, TLS termination, and request rewriting.

  4. Describe the Round Robin load balancing algorithm.

    Requests are distributed sequentially and cyclically across servers in order, giving each server an equal share regardless of current load or capacity.

  5. How does Weighted Round Robin differ from plain Round Robin?

    Each server is assigned a weight proportional to its capacity, so higher-weighted servers receive proportionally more requests instead of an equal split.

  6. What does the Least Connections load balancing algorithm optimize for?

    It routes each new request to the server currently handling the fewest active connections, balancing load when requests have variable or long-lived durations.

  7. What problem does consistent hashing solve in load balancing/distributed caching, and roughly how many keys remap when a node is added or removed?

    It maps keys and nodes onto a hash ring so that adding/removing a node remaps only about $\frac{K}{N}$ keys (K keys, N nodes) instead of nearly all of them, minimizing reshuffling.

  8. What is the purpose of virtual nodes (replicas) in consistent hashing?

    Each physical node is placed at multiple points on the ring, smoothing out uneven key distribution and load imbalance that occurs with few nodes.

  9. Distinguish an active health check from a passive health check.

    An active check proactively probes servers on an interval (e.g., HTTP GET /health, TCP connect); a passive check infers health by observing real traffic for errors/timeouts without extra probes.

  10. In health checking, what are the 'healthy threshold' and 'unhealthy threshold'?

    They are the number of consecutive successful checks required to mark a server back 'up', and the number of consecutive failed checks required to mark it 'down' — hysteresis that prevents flapping.

  11. Contrast active-active and active-passive failover configurations.

    Active-active: all nodes serve traffic simultaneously and share load (also gives capacity). Active-passive: standby nodes stay idle and take over only when the active node fails, so standby capacity is unused in normal operation.

  12. What is Global Server Load Balancing (GSLB) and what mechanism most commonly implements it?

    GSLB distributes traffic across servers in multiple geographic data centers, typically via DNS-based resolution (and Anycast), returning the optimal site per user.

  13. Name three routing policies a GSLB / geo-DNS system can use.

    Geoproximity/geolocation (nearest data center), latency-based routing (lowest measured latency), and weighted/failover routing (capacity split or disaster recovery).

  14. What does the LRU cache eviction policy evict, and what does it assume?

    LRU (Least Recently Used) evicts the entry that has gone longest without access, assuming recently used items are most likely to be used again (temporal locality).

  15. How does LFU eviction differ from LRU?

    LFU (Least Frequently Used) evicts the item with the lowest access count/frequency, favoring popularity over recency — good for stable hot sets but slow to adapt when access patterns shift.

  16. Describe the FIFO cache eviction policy and one weakness compared to LRU.

    FIFO evicts the oldest-inserted entry regardless of access; its weakness is that a frequently-used item still gets evicted simply for being old, whereas LRU would keep it.

  17. Define the cache hit ratio and give its formula.

    The fraction of requests served from cache: $$\text{Hit Ratio} = \frac{\text{cache hits}}{\text{cache hits} + \text{cache misses}}$$

  18. Explain the cache-aside (lazy loading) caching strategy.

    The application checks the cache first; on a miss it reads from the database, writes the result into the cache, then returns it. The cache is populated only on demand.

  19. Contrast write-through and write-back (write-behind) caching.

    Write-through writes to cache and database synchronously (consistent, higher write latency, no data loss). Write-back writes to cache immediately and to the database asynchronously later (low latency, higher throughput, but risk of data loss on cache failure).

  20. What is the write-around caching strategy and when is it useful?

    Writes go directly to the database, bypassing the cache; the cache is populated only on subsequent reads. It avoids flooding the cache with write-heavy data that may never be read again.

Show the other 32 Distributed System Components flashcards
  1. Give two fundamental architectural differences between Redis and Memcached.

    Redis is single-threaded (for core command processing) with rich data structures (strings, lists, sets, sorted sets, hashes), persistence, and replication; Memcached is multi-threaded, stores only simple string key-values, has no persistence, and no native replication.

  2. Which caching tool would you choose for pub/sub, sorted-set leaderboards, and durability, and which for a simple multi-threaded string cache?

    Redis for rich data structures, pub/sub, persistence, and durability; Memcached for a lightweight, multi-threaded, pure LRU string key-value cache with simple horizontal scaling.

  3. What eviction policy does Memcached use by default, and how does it allocate memory?

    Memcached uses LRU eviction and a slab allocator that divides memory into fixed-size chunk classes to reduce fragmentation (which can cause internal waste).

  4. What is a stale cache and what are the two broad approaches to cache invalidation?

    A stale cache holds data no longer matching the source of truth. The two approaches are TTL-based expiration (entries auto-expire after a time) and active/event-based invalidation (explicitly delete or update entries on writes).

  5. What is the thundering herd (cache stampede) problem?

    When a popular cached key expires, many concurrent requests miss simultaneously and all hit the backend at once to recompute the same value, overwhelming the database.

  6. Name two techniques to mitigate a cache stampede / thundering herd.

    Request coalescing / mutex locking (only one request recomputes while others wait), and probabilistic/staggered early expiration plus serving stale-while-revalidate to spread out recomputation.

  7. Differentiate the cache penetration, cache breakdown, and cache avalanche problems.

    Penetration: queries for nonexistent keys always miss and hit the DB (fix: cache null / Bloom filter). Breakdown: one hot key expires and floods the DB (fix: lock/never-expire). Avalanche: many keys expire at once (fix: randomized/jittered TTLs).

  8. What is a Point of Presence (PoP) in a CDN, and what is an edge server?

    A PoP is a physical CDN location (data center) near users containing multiple edge servers; an edge server is a cache node in a PoP that stores and serves content close to end users to cut latency.

  9. Why does edge caching reduce latency and origin load?

    Content is served from a geographically nearby PoP instead of the distant origin, shortening the network round-trip and absorbing requests so the origin sees far fewer hits.

  10. Contrast a push CDN with a pull CDN.

    Push CDN: you proactively upload/push content to edge servers ahead of time (you control what/when; good for large, infrequently changing files). Pull CDN: the edge fetches content from origin on the first user request and caches it (self-populating on demand; good for frequently updated sites).

  11. For a website with lots of traffic and frequently changing assets, which CDN type is usually preferred and why?

    A pull CDN, because it lazily caches only requested content and stays current with less manual management, whereas a push CDN requires you to re-upload on every change.

  12. What does the HTTP header `Cache-Control: max-age=3600` specify?

    It sets the freshness lifetime (TTL) of the response to 3600 seconds; the cached copy is considered fresh for one hour before it must be revalidated or refetched.

  13. Contrast the `no-cache` and `no-store` Cache-Control directives.

    `no-cache` allows storing the response but requires revalidation with the origin before each reuse; `no-store` forbids caching the response entirely (nothing is written to any cache).

  14. What do the `public` and `private` Cache-Control directives mean?

    `public` allows any cache, including shared/CDN caches, to store the response; `private` restricts storage to the end user's browser cache only, not shared intermediaries.

  15. How do the `ETag`/`If-None-Match` headers enable conditional requests?

    The server sends an `ETag` (content fingerprint); the client resends it as `If-None-Match`, and if unchanged the server replies `304 Not Modified` with no body, saving bandwidth.

  16. Contrast point-to-point and publish/subscribe messaging models.

    Point-to-point (queue): each message is consumed by exactly one receiver; competing consumers share the load. Pub/sub (topic): each message is broadcast to all subscribers, so every subscriber gets its own copy.

  17. In Kafka, what are a topic, a partition, and an offset?

    A topic is a named category of messages; a partition is an ordered, append-only log that a topic is split into for parallelism; an offset is the sequential ID of a record within a partition, tracking consumer position.

  18. How does Kafka guarantee message ordering, and how does it use consumer groups for scaling?

    Ordering is guaranteed only within a single partition (not across a topic). In a consumer group, each partition is consumed by at most one consumer in the group, so parallelism is capped by partition count.

  19. In Kafka replication, what are the leader, followers, and ISR?

    Each partition has one leader replica that handles all reads/writes and follower replicas that copy it. The ISR (In-Sync Replicas) is the set of replicas fully caught up with the leader; a message is 'committed' once all ISR members have it.

  20. What is Kafka's retention model, and how does it differ from a traditional queue?

    Kafka is a durable, replayable log: messages are retained for a configured time or size regardless of consumption, and consumers can re-read by resetting offsets — unlike traditional queues that delete a message once acknowledged.

  21. In RabbitMQ/AMQP, what is the role of an exchange versus a queue?

    Producers publish to an exchange, never directly to a queue; the exchange routes messages to bound queues based on routing keys and bindings, and consumers read from queues.

  22. Name the four main AMQP exchange types and how each routes.

    Direct (routing key equals binding key exactly), Topic (routing-key pattern match with `*` and `#` wildcards), Fanout (broadcast to all bound queues, ignoring key), and Headers (routes on message header attributes).

  23. Compare Kafka and RabbitMQ in terms of consumption model.

    Kafka is pull-based with a retained, replayable partitioned log optimized for high-throughput streaming; RabbitMQ is a smart broker that pushes messages, deletes them after ack, and excels at complex routing and low-latency task queues.

  24. Define the three message delivery guarantees: at-most-once, at-least-once, and exactly-once.

    At-most-once: message delivered 0 or 1 times (may be lost, never duplicated). At-least-once: delivered 1+ times (never lost, may duplicate — needs idempotent consumers). Exactly-once: delivered precisely once (hardest; needs dedup/transactions).

  25. What is backpressure in a messaging/streaming system, and name two ways to handle it?

    Backpressure is the mechanism by which a slow consumer signals producers to slow down when it can't keep up. Handle it via buffering/queuing, rate limiting the producer, dropping/sampling messages, or blocking (pull-based flow control).

  26. What is a dead-letter queue (DLQ) and when is a message sent there?

    A DLQ holds messages that cannot be processed successfully — e.g., repeatedly failing (exceeding max retries), rejected/nacked without requeue, expired (TTL), or exceeding queue length — for later inspection instead of blocking the main queue.

  27. Contrast a forward proxy and a reverse proxy by whom they represent.

    A forward proxy sits in front of clients and acts on their behalf toward the internet (client anonymity, filtering, caching outbound). A reverse proxy sits in front of servers and acts on their behalf toward clients (load balancing, TLS termination, hides backend).

  28. List three responsibilities commonly handled by a reverse proxy.

    Load balancing across backends, SSL/TLS termination, caching of static content, request compression/rewriting, and hiding/protecting the backend topology from clients.

  29. List four core responsibilities of an API Gateway.

    Single entry point / request routing, authentication & authorization, rate limiting/throttling, request-response transformation & aggregation, plus caching, logging/monitoring, and SSL termination.

  30. How do the token bucket and leaky bucket rate-limiting algorithms differ?

    Token bucket refills tokens at a fixed rate up to a capacity and allows bursts by spending accumulated tokens. Leaky bucket processes requests at a constant fixed rate (queue draining), smoothing bursts into a steady outflow but not permitting bursts.

  31. Contrast fixed window and sliding window rate limiting, and name the flaw fixed window has.

    Fixed window counts requests per discrete interval (e.g., per minute); its flaw is the boundary/edge burst where up to 2× the limit can pass around the window edge. Sliding window (log or weighted counter) tracks a rolling time span, smoothing that boundary spike.

  32. Which HTTP status code and header does a server return when a client is rate limited?

    HTTP `429 Too Many Requests`, typically accompanied by a `Retry-After` header telling the client how long to wait before retrying.

System Design Distributed System Components FAQ

What is in the System Design Distributed System Components syllabus?

System Design Distributed System Components is split into 6 chapters: Load Balancing, Caching, Content Delivery Networks, Message Queues and Streaming, Proxies and Gateways and Coordination Services. Together they contain 22 topics.

How many chapters are in System Design Distributed System Components?

6 chapters, containing 22 topics. The largest chapter is Load Balancing, with 4 topics.

Are there flashcards for System Design Distributed System Components?

Yes — a 52-card Distributed System Components deck, printed in full in the flashcards section of this page and available in the Examius app with spaced repetition. The free plan covers one exam of your choice, including its flashcards; Examius Pro, a one-time purchase, unlocks every other exam and deck.