Practice
1. A distributed system requires generating unique IDs across multiple services without coordination delays. Which component best ensures strictly increasing, collision-free IDs with minimal latency?
easy
Solution
Step 1: Identify uniqueness and ordering requirements
UUIDs (A) are unique but not strictly increasing; timestamps with randomness (D) risk collisions under clock skew; consensus (C) adds coordination overhead and latency.Step 2: Recognize Ticket Server role
The Ticket Server (B) centrally issues sequential IDs ensuring strict ordering and uniqueness with minimal latency due to lightweight allocation.Final Answer:
Option D -> Option DQuick Check:
Centralized Ticket Server -> strict, collision-free IDs with low latency [check]
Hint: Central server issues ordered IDs, avoiding coordination delays [check]
Common Mistakes:
2. In a horizontally scaled web service with a load balancer distributing requests to stateless app servers, at step 3 the load balancer receives a request from a client with a session cookie. What happens if the load balancer uses round-robin without sticky sessions?
easy
Solution
Step 1: Understand load balancer behavior with round-robin and no sticky sessions
Requests are distributed evenly but not consistently to the same server.Step 2: Analyze session state handling
Stateless servers do not hold session state, so routing to different servers does not cause loss; but if state is stored in-memory, session loss occurs.Final Answer:
Option D -> Option DQuick Check:
Round-robin without sticky sessions routes requests to different servers, risking session loss [check]
Hint: Round-robin without sticky sessions breaks session affinity [check]
Common Mistakes:
3. For the restaurant discovery feature, you must support millions of users searching by location with low latency. Which architecture is best suited given the constraint that restaurant data updates happen frequently (every few minutes)?
medium
Solution
Step 1: Analyze read/write pattern for restaurant discovery
High read volume with frequent writes requires low-latency reads and near-real-time updates.Step 2: Evaluate architectures
Relational DB (A) can't handle query volume with low latency; batch ETL (C) is too stale; client filtering (D) is impractical for large data.Final Answer:
Option B -> Option BQuick Check:
Distributed cache with async sync -> low latency + fresh data [check]
Hint: Async cache sync balances freshness and query speed [check]
Common Mistakes:
4. If the Booking Service loses connectivity to the Calendar Availability Service during booking confirmation, what is the most likely failure mode experienced by the user?
medium
Solution
Step 1: Trace failure impact on booking flow
Loss of connectivity prevents immediate calendar update, risking inconsistency.Step 2: Analyze failure handling
Immediate confirmation without calendar update (A) risks double bookings; timeout with error (B) hurts UX; automatic retry without delay (D) is unrealistic under network failure. Local queuing (C) allows eventual consistency with delayed confirmation.Final Answer:
Option A -> Option AQuick Check:
Local queuing delays confirmation but prevents data loss [check]
Hint: Booking queues locally on calendar service failure, delaying confirmation [check]
Common Mistakes:
5. If the Ticket Server crashes after allocating an ID block but before the client acknowledges, what is the exact failure observed in the system?
medium
Solution
Step 1: Understand Ticket Server crash impact
If the server crashes post-allocation but pre-acknowledgment, it cannot confirm the block was assigned.Step 2: Trace ID block state
The allocated block is effectively lost, causing gaps in the global ID sequence, but clients do not reuse lost blocks, preventing duplicates.Final Answer:
Option B -> Option BQuick Check:
Crash after allocation -> lost ID blocks, no duplicates [check]
Hint: Crash post-allocation loses blocks, no duplicate IDs generated [check]
Common Mistakes:
