Practice: Design Search Autocomplete System
High-QPS search autocomplete that returns ranked suggestions under 100 ms with fresh, abuse-resistant, and scalable indexing.
Build this system yourself on the canvas below. Add components, connect them, and run traffic simulations to see where your design holds up and where it breaks.
Functional requirements
- Return top‑K ranked suggestions for each typed prefix.
- Support typo tolerance and multi-language inputs.
- Ingest query/click logs and content updates for freshness.
- Rank by popularity, recency, and optional personalization.
- Per-tenant and per-API key rate limits and quotas.
- Filter sensitive/offensive suggestions by configurable policies.
- A/B switch ranking strategies without downtime.
- Admin tools to reindex, rollback, and inspect features/results.
Non-functional requirements
- Latency: p99 < 100 ms for suggest; cache hits < 10 ms.
- Availability: 99.95%+; no single AZ failure should cause downtime.
- Freshness: trending updates visible within 1–5 minutes; full reindex without downtime.
- Scalability: horizontally scale API/index/worker pools; handle 100k+ rps globally.
- Consistency: eventual for ranking/log-derived signals; strong for admin content updates.
- Security: TLS 1.2+; authenticated APIs; PII in features encrypted at rest.
- Resilience: timeouts, circuit breakers, retries with backoff, DLQ for bad events.
- Observability: traces/logs/metrics for p99, cache hit ratio, index lag, and queue depth.