Practice
1. A social media platform needs to store user posts with high write throughput and ensure efficient retrieval by user and timestamp. Which component best handles this workload?
easy
Solution
Step 1: Identify write throughput and query pattern
The system requires high write throughput and efficient retrieval by user and timestamp, which suits wide-column stores that partition data by user ID.Step 2: Evaluate options against constraints
Relational DBs struggle with high write throughput and joins; document stores lack efficient range queries by timestamp; Redis lacks durability and is not ideal for large persistent datasets.Final Answer:
Option A -> Option AQuick Check:
Wide-column store partitions by user ID -> high write throughput and efficient user queries [check]
Hint: Partition by user ID for high write and read throughput [check]
Common Mistakes:
2. In a system using Kafka for write-ahead logging to ensure strong consistency, what exactly breaks if Kafka becomes unavailable during a write operation?
medium
Solution
Step 1: Trace failure impact on write path
Without Kafka, writes accepted locally but not durably logged can be lost if the server crashes before Kafka recovers.Step 2: Eliminate other options
The system falls back to eventual consistency, causing stale reads temporarily is incorrect because fallback to eventual consistency is not automatic; The client's write blocks indefinitely until Kafka recovers, preventing data loss is wrong because writes may not block indefinitely; The system switches to causal consistency mode automatically to maintain availability is false as consistency mode does not switch automatically.Final Answer:
Option C -> Option CQuick Check:
Writes accepted locally but lost if server crashes before Kafka recovers [check]
Hint: Without Kafka, local writes risk loss if server crashes [check]
Common Mistakes:
3. For a globally distributed key-value store requiring low write latency and strong consistency, which replication approach is best and why?
medium
Solution
Step 1: Evaluate latency and consistency trade-offs
Global synchronous quorum to all regions (A) causes high latency; asynchronous (B) sacrifices strong consistency.Step 2: Consider local quorum with global reconciliation
Local quorum writes reduce latency while global reconciliation maintains strong consistency.Final Answer:
Option D -> Option DQuick Check:
Local quorum + global reconciliation balances latency and consistency [check]
Hint: Local quorum writes reduce latency, global reconciliation ensures consistency [check]
Common Mistakes:
4. For real-time message delivery to mobile clients with intermittent connectivity, which architecture best balances latency and resource usage?
medium
Solution
Step 1: Evaluate WebSocket vs gRPC streaming for mobile clients
gRPC streaming is efficient but poorly supported on many mobile platforms; WebSocket is widely supported with heartbeat to detect disconnects.Step 2: Consider fallback mechanisms
WebSocket with push notification fallback handles intermittent connectivity better than long polling or MQTT, which have higher overhead or complexity.Final Answer:
Option B -> Option BQuick Check:
WebSocket + push fallback balances latency and mobile constraints [check]
Hint: WebSocket + push fallback handles mobile connectivity best [check]
Common Mistakes:
5. At 10x traffic scale, which component in a load balanced web service is most likely to fail first, and why?
hard
Solution
Step 1: Analyze component scaling characteristics
Backend servers (The backend servers, because they cannot horizontally scale beyond a fixed number) typically scale horizontally. DNS servers (The DNS server, due to increased domain resolution requests) are highly distributed and cacheable. Load balancers (The load balancer, because it maintains stateful TCP connections and cannot shard easily) can be scaled with multiple instances and sharding.Step 2: Identify database bottleneck
Databases (The database, due to increased query volume and connection limits) often face connection limits and query volume bottlenecks first at large scale, requiring sharding or caching to scale further.Step 3: Confirm failure mechanism
Without proper scaling, the database becomes the first component to fail under 10x load due to resource exhaustion.Final Answer:
Option D -> Option DQuick Check:
Database connection limits cause first failure at 10x scale [check]
Hint: Database connection limits break first at scale [check]
Common Mistakes:
