All Questions
Scaling Reads hard

You want to prevent cache stampedes without using locking. You implement 'Probabilistic Early Expiration' (X-Fetch). How does this algorithm work?

  1. A It returns a 404 error randomly.
  2. B It creates a background thread to update all keys every second.
  3. C It uses a variable TTL. When a client reads a key, if the TTL is close to expiring (within a 'Gap' window), the client voluntarily recomputes the value based on a probability function.
  4. D It relies on the database to push updates.

One system design question a day, with spaced repetition so the ones you miss come back.

Get the app

Related questions