FjellSystem Design Lab
Chapter 6 checkpoint

Chapter 6 checkpoint: caching and invalidation

Every question from this chapter’s lessons. Your first answer to each is the one that counts; afterward you can practice again as often as you like. Passing needs 75% right on the first attempt.

0 of 17 answered0 right on the first attempt
Question 1 of 17
A cache answers in 2 ms and the database in 38 ms. A miss checks the cache and then queries the database. With a 95% hit ratio, what is the average latency per request?

Answers within 1% count, in any unit you choose.

Question 2 of 17
A catalog has 10 million products, 20% of which receive most reads. Each cached item is 2 KB, and you allow 25% extra for overhead. How much RAM does the cache need for that working set, in GB?

Answers within 5% count, in any unit you choose.

Question 3 of 17
The cache hit ratio falls from 99% to 95%. By what factor does the number of queries reaching the database grow?
×

Answers within 2% count.

Question 4 of 17
Match each caching tier to an example the lesson gives.

Question 5 of 17
With cache-aside, why should a write delete the cache entry instead of setting it to the new value?

Question 6 of 17
Match each cache update strategy to how it works.

Question 7 of 17
What do you give up by choosing write-behind instead of write-through?

Question 8 of 17
A reader misses the cache, reads V1V_1 from the database and stalls. Meanwhile a writer stores V2V_2 and deletes the key. The reader then puts V1V_1 into the cache. What prevents this “stale set”?

Question 9 of 17
Millions of requests for product ids that do not exist, such as /product/-999999, miss the cache and reach the database. What stops them?

Question 10 of 17
How does XFetch (probabilistic early expiration) shrink cache stampedes?

Question 11 of 17
Exactly one hour after a deploy, database load spikes sharply and then settles. All cache entries were filled at startup with a one-hour TTL. What prevents it next time?

Question 12 of 17
A worker takes a Redis lock with SET lock:key token NX PX 5000 before recomputing a hot key. Why should the value be a random token?

Question 13 of 17
A nightly job reads every row of a large table once, through an LRU cache. Next morning the hit ratio is terrible. Why?

Question 14 of 17
Match each eviction algorithm to what it evicts.

Question 15 of 17
A Redis cache holds keys without TTLs, and a small subset is read far more often than the rest. Which maxmemory-policy does Redis suggest as a good default?

Question 16 of 17
A Redis instance uses volatile-lru, and none of its keys has a TTL. When memory fills, what happens?

Question 17 of 17
A product service serves 50,000 reads a second. A deploy changes the cache keys, and the hit ratio falls from 99% to 90%. Which component saturates first?