Design Search Autocomplete
Every keystroke runs SELECT … WHERE name LIKE 'sho%'. What should the architecture look like instead?
Este reto aún no está traducido al Español. Estás leyendo la versión en inglés.
Misión:Build an architecture that serves suggestions from caches and a search index, keeps the index fresh from change events, protects the endpoint and stays within budget.
Hollow Basket's search box asks the main database for suggestions on every keystroke. At peak it adds 40,000 queries per second, the database slows down for checkout, the index is rebuilt by a nightly job, and a scraper hammers the endpoint.
Misión: Build an architecture that serves suggestions from caches and a search index, keeps the index fresh from change events, protects the endpoint and stays within budget.
Objetivos de aprendizaje
- Separate read-heavy search from the transactional database.
- Cache popular prefixes at the edge and in memory.
- Feed the index from change events instead of nightly rebuilds.
SimulaciónSimulado