Practice
1. A distributed system needs to generate unique 64-bit IDs that are sortable by creation time and avoid collisions across multiple data centers without central coordination. Which component design best fits this requirement?
easy
Solution
Step 1: Identify uniqueness and ordering requirements
The system requires unique 64-bit IDs sortable by creation time and no central coordination to avoid bottlenecks.Step 2: Evaluate options against constraints
UUID v4 (A) is random and not sortable; centralized DB (C) creates a bottleneck; hashing timestamp and IP (D) risks collisions and no strict ordering. Snowflake (B) combines timestamp, machine ID, and sequence to ensure uniqueness and time ordering without central coordination.Final Answer:
Option C -> Option CQuick Check:
Snowflake IDs are time-sortable and unique across machines [check]
Hint: Timestamp + machine ID + sequence ensures unique sortable IDs [OK]
Common Mistakes:
2. In a system where a load balancer forwards requests to backend servers, at step 4 the backend server checks its health status before processing the request. What happens if the health check fails at this step?
easy
Solution
Step 1: Trace backend server health check at Step 4
If the backend server health check fails, it should not process the request (The backend server processes the request anyway, risking errors is incorrect). Returning an error directly to the client (The backend server returns an error response directly to the client) bypasses the load balancer's retry logic. The load balancer retrying without backend signaling (The load balancer retries routing the request to a different healthy backend) is incomplete.Step 2: Understand backend rejection and signaling
The backend server rejects the request and signals the load balancer to reroute traffic to a healthy backend (The backend server rejects the request and signals the load balancer to reroute), ensuring availability.Final Answer:
Option A -> Option AQuick Check:
Backend signals load balancer to reroute on health check fail [check]
Hint: Backend signals reroute on health failure [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. Without the automated rollback system, what exactly breaks when a misconfiguration causes a route leak?
medium
Solution
Step 1: Trace failure without rollback
Misconfigurations propagate incorrect routes; without rollback, manual detection delays fix.Step 2: Eliminate other failure modes
Silent drops (A) don't occur; automatic quarantine (C) would cause total outage, not typical; alert floods (D) don't prevent traffic misrouting.Final Answer:
Option D -> Option DQuick Check:
Manual fix delays cause prolonged incorrect routing [check]
Hint: No rollback means manual fix delays outages [check]
Common Mistakes:
5. At 10x scale, which component in the faceted search system is most likely to fail first and why?
hard
Solution
Step 1: Analyze bottlenecks at 10x query scale
Shard nodes perform CPU-intensive inverted index lookups; query volume increase causes CPU saturation first.Step 2: Compare other components
Query Coordinator merges are parallelizable; cache evictions increase but cache can be scaled; indexing pipeline is async and can be scaled horizontally.Final Answer:
Option D -> Option DQuick Check:
Shard nodes CPU-bound -> first failure point at scale [check]
Hint: Shard nodes CPU-bound first at 10x scale [check]
Common Mistakes:
