0 ms Autocomplete for 240 Million Domain Names
Pushing the boundaries of user experience performance
1The 0 ms Target
The founder of Wirewiki.com is building a platform that provides internet infrastructure information like DNS records and email deliverability. To stand out among competitors, he aims for perfection in user experience. The autocomplete feature needs to work 'instantly' - literally ready by the next screen refresh. This means results must be prepared before the user even releases the key, creating a seamless interaction flow.
2Calculating Time Budget
The founder measured users' key press and release timings during fast typing. Tests across 100 domain names revealed a p99 value of 121 ms. This means the API must respond within 121 ms - before key release. On 60Hz displays refreshing every 16.7 ms, this provides some extra time budget. The technical challenge is to deliver suggestions within this tight window consistently.
3Data Structures & Optimization
The system operates in two tiers: An in-memory 'trie' (prefix tree) handles the top 1 million domains, storing 8 precomputed suggestions per prefix. For the full 240 million domains, an SSD-backed memory-mapped block index manages the 'tail'. This delta-compressed structure occupies just 2.5GB disk space. Popular blocks are cached in RAM by the OS, minimizing disk I/O.
4Performance Test Results
Stress tests simulated 720,000 keystrokes. The standalone API responds to most requests under 2 ms. Even at 1.6k requests/second with Nginx, p99 latency remains at 15 ms. While Cloudflare CDN adds some latency, it also provides crucial load balancing. These metrics show the system can handle real-world loads while maintaining exceptional responsiveness.
5Geographical Challenges
Achieving global 0 ms latency with a single European server proves difficult. Requests from the US experience 100-200 ms additional latency. Potential solutions include multiple geo-distributed servers, though the founder considers this over-engineering for now. Even Nielsen's 0.1s 'instantaneous' threshold falls short of the ambitious p99 0 ms* target when accounting for network physics.
6Technical Deep Dive: Trie Structure
The trie (prefix tree) data structure perfectly suits autocomplete needs. Precomputed suggestions are stored for each character prefix, with worst-case complexity O(query length). The top 1 million domains reside entirely in RAM, returning suggestions ranked by popularity. The first 8 results always represent the most visited sites, ensuring relevant suggestions for common queries.
7Big Data Management
The system manages 240 million domains through sorted, delta-compressed blocks with a tiny 27MB in-memory directory. Fixed-size 256-entry blocks enable efficient access, with the OS page cache keeping hot blocks in RAM. This architecture minimizes disk I/O while maintaining O(1)-like performance characteristics. The solution demonstrates how careful data organization can enable real-time operations at scale.
8UX Philosophy
For Wirewiki's founder, 0 ms autocomplete represents more than a technical target - it's foundational to product philosophy. This performance level preserves users' sense of flow during searches. Pushing technical boundaries to deliver perfection, even for a niche audience, reflects a commitment to exceptional user experience. The founder aims to apply this standard across all platform aspects, setting a new benchmark for infrastructure tools.
Original article: Hacker News (news.ycombinator.com) — 240 Milyon Alan Adı için 0 ms Autocomplete