Practice
1. A system design interview requires you to explain how you handle conflicting requirements between latency and consistency. Which component or approach best helps you present this trade-off clearly to the interviewer?
easy
Solution
Step 1: Identify the need to clarify trade-offs
Presenting trade-offs requires explicit comparison of conflicting requirements, such as latency vs consistency.Step 2: Use a decision matrix for clarity
A decision matrix systematically compares options, showing pros and cons clearly, which helps interviewers understand your reasoning.Final Answer:
Option A -> Option AQuick Check:
Decision matrix clarifies trade-offs explicitly [check]
Hint: Use decision matrices to clarify conflicting trade-offs [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. In a distributed chat system, at Step 4 the Delivery Worker reads from Kafka and attempts to deliver a message to Bob's device. What happens if Bob's device is offline at this step?
easy
Solution
Step 1: Trace Delivery Worker decision at Step 4 -- Bob's device offline
The Delivery Worker reads the message from Kafka but cannot deliver it immediately because Bob is offline.Step 2: Understand retry and message retention behavior
The worker retries delivery asynchronously and keeps the message in Kafka until Bob acknowledges receipt. It does not block other deliveries or delete messages prematurely.Final Answer:
Option A -> Option AQuick Check:
Delivery Worker retries and retains message until ack [check]
Hint: Offline devices cause retries, not message loss or blocking [check]
Common Mistakes:
4. At 10x scale, which cache component is most likely to fail first due to stateful eviction metadata, and why?
hard
Solution
Step 1: Identify stateful eviction metadata bottleneck
Eviction policies like LFU or ARC maintain frequency counts or recency lists, which grow with cache size and cause CPU/memory bottlenecks.Step 2: Compare other components
Storage backend scales with hardware; network and TTL timers are less stateful or can be sharded more easily.Final Answer:
Option A -> Option AQuick Check:
Eviction metadata management bottlenecks first at large scale [check]
Hint: Eviction metadata scales poorly, causing bottlenecks first [OK]
Common Mistakes:
5. At 10x scale, which component of the Snowflake ID generation system is most likely to become the bottleneck first, and why?
hard
Solution
Step 1: Analyze timestamp and network constraints
Timestamp synchronization (A) is challenging but tolerable with NTP; network coordination (D) is minimal as IDs are generated locally.Step 2: Evaluate sequence number limits
Sequence number (B) limits per millisecond can cause blocking but can be mitigated by load balancing or sharding.Step 3: Identify machine ID allocation bottleneck
Machine ID bits are fixed (e.g., 10 bits), limiting the number of unique machines. At 10x scale, running out of unique machine IDs causes collisions or requires complex reallocation.Final Answer:
Option D -> Option DQuick Check:
Fixed machine ID bits limit scale -> collisions or reconfiguration needed [check]
Hint: Fixed machine ID bits limit scale before sequence or timestamp issues [OK]
Common Mistakes:
