Design search typeahead
Suggestions must appear in under 100 ms while the user is still typing, which rules out ranking anything at read time. This derives the latency budget, builds a trie whose nodes cache their own answers, and then handles the parts that make it a real system — updating popularity from a stream, trimming memory, and personalisation.
What you'll be able to do
- Derive the read-path latency budget and show why ranking must be precomputed
- Implement a prefix trie with per-node cached top-k and state its memory cost
- Design the offline path that turns a query stream into weights, with decay and safety filtering
- Handle sharding by prefix, client-side debouncing and caching, and personalisation
Before this: caching-and-stampedes, consistent-hashing
The rest of this lesson is in the app
Suggestions must appear in under 100 ms while the user is still typing, which rules out ranking anything at read time. This derives the latency budget, builds a trie whose nodes cache their own answers, and then handles the parts that make it a real system — updating popularity from a stream, trimming memory, and personalisation. This walkthrough runs about 26 minutes, with runnable code you can edit and re-run as you read.
Continue in ChannelPulseThe first module of every track is free to read on the web — see what's open in System design.