Practice
1. A social media platform needs to handle 1 million vote updates per second with low latency and durability. Which component is best suited to buffer and reliably process these vote events before updating the main datastore?
easy
Solution
Step 1: Identify the need for durability and ordering
Relational DB synchronous writes (Use a relational database with immediate synchronous writes for each vote) cause high latency and don't scale to 1M writes/sec. Redis without persistence (Use an in-memory cache like Redis without persistence to handle votes) risks data loss on failure. Batch processing (Use a batch processing system that aggregates votes every hour) introduces unacceptable latency.Step 2: Recognize Kafka's role
Kafka provides durable, ordered, high-throughput buffering of vote events, decoupling ingestion from processing.Final Answer:
Option D -> Option DQuick Check:
Kafka buffers high-write streams with durability and ordering [check]
Hint: Kafka buffers high-write streams with durability and ordering [check]
Common Mistakes:
2. For a large-scale code repository system supporting millions of users, which branching strategy best balances performance and user flexibility?
medium
Solution
Step 1: Analyze branching strategies for scale
Lightweight branch pointers referencing immutable commits allow fast branch creation and merges without locking, supporting high concurrency.Step 2: Evaluate other options
Centralized locking serializes operations, hurting performance; full branch copies waste storage and complicate merges; synchronous replication adds latency and reduces availability.Final Answer:
Option B -> Option BQuick Check:
Immutable commits + lightweight pointers -> scalable branching [check]
Hint: Immutable commits enable lightweight, scalable branches [check]
Common Mistakes:
3. If the Metadata Server crashes before acknowledging a file rename operation, what is the most likely failure observed by the client?
medium
Solution
Step 1: Understand rename operation atomicity
Rename involves updating metadata entries; if crash occurs mid-update, partial state may persist.Step 2: Trace failure effect
Partial metadata update can cause both old and new filenames to appear, confusing clients.Final Answer:
Option D -> Option DQuick Check:
Partial metadata updates cause duplicate filenames visible to client [check]
Hint: Partial metadata update causes duplicate filenames visible [check]
Common Mistakes:
4. You must implement a distributed lock for a system with high contention and strict latency requirements. Which approach is best and why?
medium
Solution
Step 1: Evaluate Redis SETNX under high contention
Redis SETNX with TTL (A) is fast but can cause split-brain and stale locks under network partitions, violating correctness.Step 2: Consider consensus-based lock service
Consensus-based services like etcd (B) provide strong consistency and fault tolerance, ensuring correctness even if latency is higher.Step 3: Assess database row locks and local locks
Database locks (C) have high latency and risk deadlocks; local locks (D) do not coordinate across nodes, failing correctness.Final Answer:
Option B -> Option BQuick Check:
Consensus ensures correctness under contention despite latency [check]
Hint: Consensus beats speed for correctness under contention [check]
Common Mistakes:
5. At 10x scale, which component in a synchronous quorum replication system is most likely to become the bottleneck and why?
hard
Solution
Step 1: Identify synchronous quorum coordinator role
Coordinator waits synchronously for majority acks, causing latency and throughput limits.Step 2: Compare other components' scaling challenges
Storage nodes and network scale better; client-side blocking is per client, less centralized.Final Answer:
Option A -> Option AQuick Check:
Coordinator sync wait limits throughput at scale [check]
Hint: Coordinator sync wait blocks throughput first at scale [check]
Common Mistakes:
