Building at the Edge: How Hummingbird Achieves Sub-100ms Latency
A deep dive into the architecture decisions that make Hummingbird one of the fastest geolocation APIs available.
When we set out to build Hummingbird, we had a clear goal: create the fastest geolocation API possible. Here’s how we achieved sub-100ms median latency.
The Traditional Approach (And Why It’s Slow)
Most geolocation APIs follow a familiar pattern:
- Request hits a load balancer
- Routes to a central data center
- Queries a database
- Returns the response
The problem? Geography. If your server is in Virginia and your user is in Singapore, you’re looking at 200+ milliseconds just for the round trip.
The Edge-First Architecture
Hummingbird takes a different approach. Instead of running from central data centers, we run on Cloudflare Workers at 300+ edge locations worldwide.
How It Works
- Request arrives at the nearest edge - Cloudflare routes to the closest PoP automatically
- Data is already there - Our geolocation database is replicated to every edge location
- Response returns immediately - No cross-continent hops needed
The Results
- Median latency: Under 100ms globally
- P95 latency: Under 150ms
- P99 latency: Under 200ms
Compare this to traditional APIs that often have 200-500ms response times.
The Database Challenge
The tricky part of edge computing is data. Traditional databases don’t work well at the edge - you can’t replicate PostgreSQL to 300 locations.
We solved this by:
- Pre-processing - Our IP geolocation data is optimized at build time
- Binary search - Lookups are O(log n), extremely fast
- Smart caching - Frequently accessed data stays hot
What We Learned
Building for the edge requires rethinking assumptions:
- Stateless is essential - Each request is independent
- Data size matters - Every byte gets replicated
- Cold starts are real - Optimize initialization
Try It Yourself
Experience the speed difference. Sign up for free and make your first request in under a minute.
Want to learn more about our architecture? Have questions? Get in touch.