Practice
Solution
Step 1: Identify ordering requirement per user session
Kafka partitions keyed by user session ID guarantee ordering within that partition, ensuring requests are processed sequentially per user.Step 2: Evaluate alternatives
Relational DB row-level locking (A) causes high contention and poor scalability under 10x burst. Redis (C) lacks strong ordering guarantees and durability. Load balancer (D) only distributes load but does not preserve order.Final Answer:
Option C -> Option CQuick Check:
Kafka partition key -> per-session ordering guaranteed [check]
Solution
Step 1: Understand KSUID structure at step 4
KSUIDs combine a 4-byte timestamp prefix with a 16-byte random payload to ensure uniqueness and sortability.Step 2: Eliminate incorrect states
Deterministic timestamp only (A) lacks uniqueness; UUIDv4 (C) is unrelated; sequential number (D) is not part of KSUID design.Final Answer:
Option C -> Option CQuick Check:
KSUID = timestamp + random payload for uniqueness and sortability [check]
Solution
Step 1: Analyze push vs pull for dynamic content freshness
Push model can overload origin with frequent updates; polling adds unnecessary load.Step 2: Evaluate pull with TTL caching
Pull with TTL balances freshness and origin load by caching briefly and refreshing on expiry.Final Answer:
Option A -> Option AQuick Check:
Pull with TTL caching balances freshness and origin load [check]
Solution
Step 1: Identify scaling impact on Bloom filter components
At very high scale, hash function computation cost increases linearly with insertions, becoming a CPU bottleneck.Step 2: Evaluate other components
Bit array saturation affects false positives but does not cause immediate failure; network and client latency scale better.Final Answer:
Option C -> Option CQuick Check:
Hash function CPU cost grows linearly, causing first failure at scale [check]
Solution
Step 1: Identify stateful bottlenecks at scale
Personalization retraining (Personalization service because recommendation model retraining becomes too slow) can be scaled horizontally with distributed training. Origin storage (Origin servers because storage I/O bandwidth saturates under high request volume) can be scaled with sharding and CDN caching. Client devices (Client devices because decoding multiple bitrate streams consumes excessive CPU) are outside server control.Step 2: Analyze CDN edge server scaling challenges
WebSocket connections for adaptive streaming are stateful and bound to specific edge servers, limiting horizontal scaling and resharding, causing edge server overload at 10x scale.Final Answer:
Option C -> Option CQuick Check:
Stateful WebSocket limits CDN edge server scalability [check]
