Practice
1. A distributed system requires a component to ensure a single value is agreed upon by a majority of nodes despite failures. Which component best handles this consensus requirement?
easy
Solution
Step 1: Identify the role of consensus algorithms
Consensus algorithms like Paxos and Raft are designed to ensure agreement on a single value among distributed nodes despite failures.Step 2: Eliminate other options
Redis is a cache and does not guarantee consensus; load balancers distribute load but do not coordinate agreement; Kafka buffers messages but does not ensure single-value agreement.Final Answer:
Option A -> Option AQuick Check:
Consensus algorithms guarantee majority agreement despite failures [check]
Hint: Consensus algorithms ensure majority agreement despite failures [check]
Common Mistakes:
2. In the Redlock algorithm request flow, at Step 4 the client attempts to acquire locks on all Redis masters. What happens if the client successfully acquires locks on only 3 out of 5 masters within the timeout?
easy
Solution
Step 1: Trace client lock acquisition at Step 4
Redlock requires majority of Redis masters to be locked within timeout to consider lock acquired.Step 2: Handle partial lock acquisition
If fewer than majority locks acquired, client must release any partial locks to avoid deadlocks and retry.Final Answer:
Option B -> Option BQuick Check:
Partial lock acquisition -> release all and retry [check]
Hint: Partial locks -> release all, no partial ownership [check]
Common Mistakes:
3. If Kafka is unavailable, what exactly breaks in the tweet delivery pipeline?
medium
Solution
Step 1: Role of Kafka in delivery pipeline
Kafka buffers tweets asynchronously for fan-out; unavailability stops new fan-out events.Step 2: Trace failure impact
Tweets still persist in DB, but without Kafka, timeline caches don't get updated, causing stale timelines.Step 3: Eliminate other options
Immediate loss (A) is prevented by DB persistence; ingestion blocking (B) unlikely as writes decouple; synchronous RPC fallback (D) not implemented.Final Answer:
Option A -> Option AQuick Check:
Kafka outage stalls fan-out, causing stale timeline caches [check]
Hint: Kafka outage stalls fan-out, stale timelines appear [check]
Common Mistakes:
4. For a faceted search system with frequent filter updates and millions of documents, which architecture better balances update latency and query freshness?
medium
Solution
Step 1: Compare update latency and query freshness trade-offs
Batch rebuilds have high latency; synchronous writes hurt write throughput; static monthly refresh is too stale.Step 2: Identify near-real-time indexing benefits
Streaming updates asynchronously balances freshness and throughput, allowing queries to see recent changes with low delay.Final Answer:
Option A -> Option AQuick Check:
Near-real-time streaming -> balanced freshness and update latency [check]
Hint: Near-real-time streaming balances freshness and throughput [check]
Common Mistakes:
5. Without the DAU Estimator component, what exactly breaks in the system's capacity planning process?
medium
Solution
Step 1: Identify DAU Estimator role
DAU Estimator provides daily active user count critical for bandwidth calculations as bandwidth depends on total active users.Step 2: Eliminate other options
The system cannot estimate peak QPS, causing under-provisioning of servers is incorrect because peak QPS depends on instantaneous requests, not just DAU; Storage estimation becomes inaccurate because DAU is a key multiplier for daily data volume is partially true but storage depends more on total objects, not DAU alone; User authentication fails because DAU tracks active sessions is unrelated to authentication.Final Answer:
Option A -> Option AQuick Check:
Bandwidth depends directly on DAU for total data transfer [check]
Hint: Bandwidth depends directly on DAU count [check]
Common Mistakes:
