Practice
1. 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:
2. A web application requires real-time bidirectional communication with low latency and minimal overhead for interactive gaming. Which technology best fits this requirement?
easy
Solution
Step 1: Identify communication direction and latency needs
Interactive gaming requires low latency and bidirectional communication, which Server-Sent Events and Long Polling do not efficiently provide.Step 2: Evaluate protocol capabilities
WebSockets provide full-duplex communication with minimal overhead, ideal for real-time interactive applications. HTTP/2 multiplexing is not widely supported for bidirectional streaming in browsers and adds complexity.Final Answer:
Option A -> Option AQuick Check:
WebSockets enable low-latency bidirectional streams [check]
Hint: Bidirectional + low latency -> WebSockets [check]
Common Mistakes:
3. A system must handle 1 million writes per second and fan-out to millions of users asynchronously. Which component best handles decoupling write load from delivery?
easy
Solution
Step 1: Identify the need for decoupling writes from fan-out
Handling 1 million writes per second with synchronous fan-out is not feasible on a single machine or direct calls.Step 2: Evaluate components for asynchronous buffering
Kafka provides durable, partitioned logs that buffer writes and allow scalable asynchronous delivery. Relational DBs can't handle this write load synchronously. Redis lacks durability guarantees for this scale. Direct HTTP calls block and don't scale.Final Answer:
Option D -> Option DQuick Check:
Kafka buffers writes asynchronously, enabling high write throughput [check]
Hint: Use durable queues to decouple high write load [check]
Common Mistakes:
4. For propagating trace context across asynchronous messaging systems, which approach best preserves trace continuity without coupling services tightly?
medium
Solution
Step 1: Understand asynchronous trace context propagation
Embedding trace context in message metadata headers leverages messaging system features to propagate context without modifying payload or tight coupling.Step 2: Evaluate other options
HTTP headers don't exist in messaging protocols. Centralized DB lookup adds latency and coupling. Generating new trace IDs breaks trace continuity and requires complex offline correlation.Final Answer:
Option A -> Option AQuick Check:
Message metadata headers preserve trace context asynchronously [check]
Hint: Use message metadata headers, not payload or DB lookup [OK]
Common Mistakes:
5. At 10x scale, which component of the vector database is most likely to become the first bottleneck, and why?
hard
Solution
Step 1: Analyze scaling challenges of components
Persistent storage (The persistent vector storage, because disk I/O cannot keep up with write volume) can be scaled horizontally with sharding; network bandwidth (The query API servers, because network bandwidth saturates with large result sets) can be optimized with compression.Step 2: Evaluate HNSW index maintenance
HNSW graph updates require CPU-intensive link adjustments and are difficult to parallelize, causing CPU bottlenecks at scale.Final Answer:
Option D -> Option DQuick Check:
HNSW index maintenance CPU-bound and hard to shard, first to bottleneck [check]
Hint: HNSW index updates CPU-bound, hard to parallelize at scale [check]
Common Mistakes:
