Personalized search result caching

DesignHard45 minAmazon style

Your task

Design the caching layer for a search backend doing 80k QPS where a small set of head queries ('iphone', 'dress') is a huge fraction of traffic, but results are personalized and freshness-sensitive: the same query returns different results per user (their location, their LTR features) and results change as inventory/prices update. A naive whole-result cache is wrong (it'd serve one user's personalized list to another) and stale (prices move). What do you cache, at what layer, and how do you invalidate?

It covers

  • Caching
  • Result cache invalidation
  • Personalization cache