Practice
1. A chat system must handle 1 million concurrent user requests, each requiring low-latency token streaming from a large language model. Which component is best suited to buffer and stream tokens efficiently to clients?
easy
Solution
Step 1: Identify token streaming requirements
Token streaming demands low latency and ordered delivery with backpressure to avoid overwhelming clients.Step 2: Evaluate component suitability
Relational DBs (A) add latency and locking overhead; distributed file systems (C) are too slow for real-time streaming; batch processing (D) adds unacceptable delay. Redis Streams (B) supports in-memory buffering with backpressure and ordered delivery.Final Answer:
Option C -> Option CQuick Check:
Redis Streams supports ordered, low-latency token streaming with backpressure [check]
Hint: In-memory queues handle streaming better than DBs or batch [check]
Common Mistakes:
2. For real-time analytics requiring low-latency dashboards and complex ad-hoc queries, which architecture is best suited?
medium
Solution
Step 1: Evaluate streaming aggregation and query needs
Flink excels at complex streaming aggregations; OLAP stores support fast ad-hoc queries and low-latency dashboards.Step 2: Eliminate other options
Kafka Streams lacks complex query capabilities; batch ETL adds latency unsuitable for real-time; NoSQL key-value stores lack rich query support for dashboards.Final Answer:
Option D -> Option DQuick Check:
Flink + OLAP store balances streaming and query complexity [check]
Hint: Flink streams, OLAP queries for real-time + ad-hoc [check]
Common Mistakes:
3. For a proximity service requiring low-latency queries and frequent updates of business locations, which spatial indexing approach is better and why?
medium
Solution
Step 1: Compare update and query costs
Quadtree (Use a Quadtree because it supports fast insertions and deletions with balanced trees) can become unbalanced and expensive to update frequently. R-tree (Use a full R-tree index because it guarantees minimal overlap and tight bounding rectangles) is complex and costly to maintain with frequent writes.Step 2: Evaluate Geohash benefits
Geohash (Use Geohash-based indexing because it supports efficient prefix queries and simpler updates) encodes locations into fixed-length strings allowing efficient prefix queries and simpler incremental updates, ideal for low-latency and frequent writes.Final Answer:
Option A -> Option AQuick Check:
Geohash supports efficient prefix queries and simpler updates [check]
Hint: Geohash enables fast prefix queries and simpler frequent updates [OK]
Common Mistakes:
4. Without explicitly defining system constraints during your 45-minute design answer, what failure mode is most likely to occur in your final design?
medium
Solution
Step 1: Trace impact of missing constraints
Without constraints, design choices conflict and trade-offs are unclear, leading to incomplete or inconsistent design.Step 2: Exclude unrealistic outcomes
Automatic scaling or perfect design without iteration is unrealistic; architecture does not default automatically.Final Answer:
Option B -> Option BQuick Check:
Missing constraints -> conflicting design decisions [check]
Hint: Constraints prevent conflicting designs [check]
Common Mistakes:
5. At 10x traffic scale, which component of a global server load balancing system is most likely to fail first and why?
hard
Solution
Step 1: Analyze scaling challenges
Health monitoring (The health monitoring system, due to increased frequency of health checks overwhelming it) scales with checks but can be optimized; control plane (The GSLB control plane, as it struggles to process and update routing decisions for all data centers in real-time) is distributed and designed for scale; ingress routers (The data center ingress routers, since network bandwidth scales linearly and saturates quickly) scale with network upgrades.Step 2: Identify DNS bottleneck
DNS servers face query volume spikes and caching TTLs limit failover responsiveness, making them the first to fail under 10x load.Final Answer:
Option D -> Option DQuick Check:
DNS query volume and caching limits cause first failure at scale [check]
Hint: DNS query volume overloads servers first at scale [check]
Common Mistakes:
