Personalized typeahead at scale

DesignHard45 minAmazon style

Your task

Design a personalized typeahead for a marketplace search box at 1M autocomplete QPS, p99 < 40ms. The catch: the suggestion list for a given prefix must blend three sources at request time, a global popularity-ranked completion trie, this user's own recent searches and purchases (the last ~90 days), and what's hot in the user's current session (e.g. they just searched 'tent', so 'sleeping bag' should rise). You must not regress the 40ms budget by doing a per-request ML scoring round trip. How do you structure the index, where does personalization live, and how do you merge the three lists deterministically?

It covers

  • Personalization
  • Session context
  • Blending