Practice
1. In a system where a client writes a user profile update to DynamoDB, then a cache invalidation message is sent to Redis at step 4, what happens if the cache invalidation fails at step 4?
easy
Solution
Step 1: Trace cache invalidation at step 4
Cache invalidation is asynchronous and best-effort; failure does not rollback DB writes.Step 2: Understand failure impact on cache state
If invalidation fails, Redis cache remains stale until TTL expiry or next explicit refresh.Final Answer:
Option C -> Option CQuick Check:
Failed cache invalidation -> stale cache until TTL or manual refresh [check]
Hint: Failed cache invalidation -> stale cache, DB write persists [check]
Common Mistakes:
2. A public API receives millions of requests per minute from diverse clients. To prevent abuse, which layer should primarily enforce a global rate limit that blocks excessive requests before reaching internal services?
easy
Solution
Step 1: Identify the role of API Gateway
The API Gateway acts as the first entry point and can block abusive traffic before it reaches internal services or databases.Step 2: Evaluate other layers
Database-level rate limiting is too late and risks overload; service-level limits are per-service and don't prevent global abuse; client-side limits are unreliable as clients can be malicious.Final Answer:
Option C -> Option CQuick Check:
API Gateway blocks abusive requests early [check]
Hint: Block abusive traffic earliest at API Gateway [check]
Common Mistakes:
3. In a system where a stateless API Gateway forwards requests to stateful backend services, at step 4 the backend service checks the user's session cache. What happens if the session cache has expired?
easy
Solution
Step 1: Trace backend session cache check
If session cache expired, backend must retrieve fresh session data to maintain stateful context.Step 2: Understand fallback mechanism
Fetching from centralized session store ensures consistent session state before processing request.Final Answer:
Option A -> Option AQuick Check:
Expired cache triggers centralized session fetch -> consistent state [check]
Hint: Expired cache -> fetch centralized session before processing [check]
Common Mistakes:
4. If the Bloom filter component is removed from a Cassandra-like system, what exact failure occurs during a read request for a non-existent key?
medium
Solution
Step 1: Understand Bloom filter role in reads
Bloom filters prevent unnecessary disk reads for non-existent keys but do not affect correctness of existing keys.Step 2: Trace failure without Bloom filters
Without Bloom filters, reads for non-existent keys cause disk lookups, increasing latency but do not cause incorrect key-not-found errors for existing keys; however, missing Bloom filters can cause stale data to be returned if caching is mismanaged.Final Answer:
Option D -> Option DQuick Check:
Removing Bloom filters risks incorrect key-not-found errors due to stale cache [check]
Hint: No Bloom filter -> stale cache causes wrong misses [check]
Common Mistakes:
5. At 10x scale, which component is most likely to become the bottleneck first in the typeahead system, and why?
hard
Solution
Step 1: Analyze component scalability
Personalization stores can be sharded; ranking computations scale linearly; front-end servers can be horizontally scaled.Step 2: Identify Trie cache bottleneck
Trie caches hold large in-memory prefix trees; sharding by prefix has limits due to prefix overlap and memory footprint, causing latency and memory bottlenecks.Final Answer:
Option D -> Option DQuick Check:
Trie cache memory and shard limits -> first bottleneck at 10x scale [check]
Hint: Trie cache memory limits cause first bottleneck at scale [check]
Common Mistakes:
