Executive Summary
Address auto-completion is a critical checkout and registration bottleneck. For businesses processing transactions, delays or typing mistakes lead directly to cart abandonment and logistical errors. Off-the-shelf address APIs charge expensive per-lookup fees and introduce high network round-trip latencies, slowing down forms.
AHM Labs built FastAddress UK: a specialized, self-hosted address auto-completion engine written in Go. By processing and indexing raw UK postcode, EPC, and land registry datasets, we created a single-purpose API that handles heavy concurrent search spikes with sub-millisecond latency profiles (P50 < 1.5ms) on modest hardware.
1. The Challenge of Scale & Cost
Indexing millions of detailed address rows (including coordinate details and suffix variations) normally requires massive database clusters or expensive software-as-a-service (SaaS) subscription tiers.
Our goal was to build a system that:
- Low-Latency Fuzzy Autocomplete: Returns exact matching suggestions in under 5ms.
- Low Hardware Resource Footprint: Runs on lightweight VPS instances without needing heavy server clusters.
- No Expensive Subscriptions: Uses open UK address/postal registries ingested locally.
2. Technical Stack & Optimization
We engineered a dual-stage pipeline focusing on Go and database optimizations:
[CSV Data Source] ──(CLI Ingest)──> [SQLite FTS5 DB] <──(REST API Server) ── [LRU Cache]
▲
│
[GET /autocomplete]
Ingestion CLI
- Processes raw postcode and EPC CSV files (over 21.1+ million property records).
- Normalizes address strings, standardizes flat/unit numbers, and compresses coordinate types into small binary allocations.
- Compiles the dataset into a local SQLite database utilizing the FTS5 (Full-Text Search) extension with custom tokenizers.
High-Concurrency Go API Server
- Built using a high-concurrency Go HTTP server communicating via the purego-based Turso driver.
- Bypasses CGO dependencies to run entirely containerized with zero library overhead.
- Implements an app-level, in-memory Least Recently Used (LRU) Cache to immediately resolve popular search terms in microseconds.
3. Proven Benchmark Performance
To validate the engine, we simulated extreme spike traffic replicating typical retail sales events:
| Metric | Measured Value | Business Benefit |
|---|---|---|
| Simulated Concurrent Load | 3,000 requests/sec | Handles high-traffic product launches effortlessly. |
| P50 Query Latency | 1.2 ms | User feels zero lag while typing. |
| P99 Query Latency | 4.8 ms | Guarantees reliability even during search spikes. |
| Idle Memory Consumption | < 100 MB | Extremely cheap to host on micro VPS instances. |
4. Conclusion & In-Depth Technical Teardown
With fastAddress, AHM Labs proves that moving off bloated SaaS providers to high-performance, single-purpose Go microservices can cut operating costs to near zero while significantly improving application responsiveness.
- 📖 Read the full engineering deep dive: How We Indexed 21.1M UK Property Records on a £5/mo VPS
- 🌐 Explore the live API & NPM SDK: fastaddress.ahm-labs.com