Practice
1. A messaging system must handle 1 million writes per second and fan-out delivery to thousands of consumers without blocking producers. Which component is primarily responsible for decoupling producers from consumers to achieve this?
easy
Solution
Step 1: Identify the decoupling mechanism
Relational DBs with WAL (Use a relational database with write-ahead logging to buffer messages) are durable but cannot handle 1M writes/sec with fan-out efficiently; Redis (Use a centralized in-memory cache like Redis to store messages temporarily) is fast but lacks durability and persistence guarantees at this scale; direct HTTP calls (Use direct synchronous HTTP calls from producers to consumers) block producers and do not decouple.Step 2: Recognize distributed brokers' role
Distributed message brokers with partitioned logs (Use a distributed message broker with partitioned logs and asynchronous consumers) allow asynchronous writes and reads, decoupling producers and consumers, enabling high throughput and scalable fan-out.Final Answer:
Option D -> Option DQuick Check:
Partitioned broker logs decouple producers and consumers for high throughput [check]
Hint: Partitioned brokers decouple producers and consumers [check]
Common Mistakes:
2. Given a system that must maintain availability during a regional outage but can tolerate eventual consistency, which architecture is preferable to minimize blast radius?
medium
Solution
Step 1: Identify availability vs consistency trade-off
Asynchronous replication with eventual consistency allows regions to operate independently during outages, reducing blast radius.Step 2: Evaluate alternatives
Synchronous replication (A, C) blocks on remote writes, increasing outage impact; centralized cache (D) is a single point of failure.Final Answer:
Option B -> Option BQuick Check:
Async replication -> availability during regional failures [check]
Hint: Async replication favors availability, sync blocks cause outages [check]
Common Mistakes:
3. If the token assignment metadata is lost or corrupted in a consistent hashing system with virtual nodes, what exactly breaks?
medium
Solution
Step 1: Understand role of token assignment metadata
Token metadata maps virtual nodes to physical nodes; losing it breaks new node integration.Step 2: Trace failure impact
Existing nodes continue serving keys assigned before loss; new nodes cannot be assigned tokens properly.Final Answer:
Option A -> Option AQuick Check:
Token metadata loss blocks new node assignment; existing nodes unaffected [check]
Hint: Token metadata loss blocks new nodes, existing nodes serve [check]
Common Mistakes:
4. At 10x scale, which MongoDB component is most likely to become the bottleneck first when using the bucket pattern for time-series data, and why?
hard
Solution
Step 1: Identify bucket pattern scaling challenges
Bucket pattern creates many bucket documents requiring precise routing by mongos.Step 2: Mongos metadata overhead
Mongos maintains routing metadata and must route each write to correct shard and bucket, increasing load at scale.Step 3: Compare other components
Shard servers handle writes but document splits are less frequent; network saturates later; app server bottleneck unlikely.Final Answer:
Option B -> Option BQuick Check:
Mongos routing metadata load grows fastest at 10x scale [check]
Hint: Mongos routing metadata overload is first bottleneck at scale [check]
Common Mistakes:
5. At 10x scale, which component in a Zookeeper-based leader election and configuration system is most likely to become the bottleneck first, and why?
hard
Solution
Step 1: Identify Zookeeper ensemble roles
Leader node serializes all writes and manages session heartbeats.Step 2: Analyze scaling impact
At 10x scale, leader node CPU and network become bottleneck due to serialized writes and session management.Step 3: Evaluate other components
Followers handle reads and watches but are less bottlenecked; storage backend is optimized for writes.Final Answer:
Option D -> Option DQuick Check:
Zookeeper leader serializes writes -> first bottleneck at scale [check]
Hint: Leader node serializes writes -> first bottleneck at scale [check]
Common Mistakes:
