惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 三生石上(FineUI控件)
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
Hugging Face - Blog
Hugging Face - Blog
Apple Machine Learning Research
Apple Machine Learning Research
博客园 - Franky
MyScale Blog
MyScale Blog
A
About on SuperTechFans
博客园_首页
B
Blog RSS Feed
Martin Fowler
Martin Fowler
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Vercel News
Vercel News
C
Check Point Blog
H
Hackread – Cybersecurity News, Data Breaches, AI and More
博客园 - 【当耐特】
M
MIT News - Artificial intelligence
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
I
InfoQ
罗磊的独立博客

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant
How Uber Finds Nearby Drivers Using H3 Hexagonal Indexing
vip20000 · 2026-05-17 · via DEV Community

How Uber Finds Your Driver in Milliseconds: The H3 Hexagonal Indexing System

Every time you request an Uber, the system silently solves a hard problem:

out of thousands of moving drivers across a city, which one can reach you the fastest — in real time, at massive scale?

The answer involves a surprisingly elegant idea: hexagons.


The Naive Approach: Radius-Based Search

The obvious solution goes something like this:

  1. Take the rider's latitude and longitude
  2. Draw a circular search radius around them
  3. Query all drivers inside that circle
  4. Calculate distance or ETA
  5. Pick the best driver

For a small system, this works fine. But Uber processes millions of ride requests per second across dense cities. At that scale, this approach breaks down fast.

The core problem: every ride request creates a brand-new dynamic circle. The system has to repeatedly perform:

  • Distance calculations for every nearby driver
  • Bounding-box scans before narrowing to the actual circle
  • Spatial filtering to check who's actually inside the search region
  • Sorting by distance, ETA, and traffic

Databases aren't naturally optimized for circular geographic queries. Databases also aren't naturally optimized for circular geographic searches.

  • Every rider creates a slightly different search area, which makes caching difficult because query results cannot be reused easily.
  • Sharding also becomes complicated. If a search radius overlaps multiple geographic regions managed by different servers, the system may need to query several machines and combine the results.
  • And as traffic increases, the number of real-time geographic calculations increases as well, making the system expensive to scale horizontally across servers.

As driver density grows in busy cities, CPU usage and latency spike. Uber needed a fundamentally different approach.


The Key Insight: Discretize Space

Instead of treating the Earth as continuous latitude-longitude space, Uber asked: what if we divided it into fixed, pre-defined regions with stable IDs?

That's exactly what H3 does.

H3 is a geospatial indexing system developed by Uber that partitions the entire Earth into hexagonal cells at multiple resolutions. Every cell has a unique ID. Any latitude-longitude pair maps deterministically to exactly one hex ID:

Latitude + Longitude → H3 Hex ID

Enter fullscreen mode Exit fullscreen mode

This conversion is a fast, stateless mathematical operation — microseconds, no database lookup required. The same coordinates always produce the same hex ID.

Why hexagons? Unlike squares, all six neighbors of a hexagon are equidistant from its center. This makes neighbor lookups geometrically consistent, which matters a lot when you're searching outward from a point.


Uber H3 Indexing


How H3 Changes the Search Problem

With H3, Uber no longer generates search regions dynamically at runtime. The global grid already exists. Drivers are continuously mapped to hex IDs as they move. When a driver crosses a hex boundary, the system updates their associated hex ID — a cheap, stable operation even for constantly moving drivers.

Instead of asking:

"Which drivers are inside this dynamically generated circle?"

Uber now asks:

"Which drivers exist in this hexagon and its immediate neighbors?"

That shift changes everything.

When you request a ride, the flow looks roughly like this:

1. Your lat/lng is converted to an H3 hex ID (microseconds)
2. Uber looks up drivers in your hex and neighboring hexes (k-ring lookup)
3. A small candidate set of drivers is returned — typically a few dozen
4. Precise ETA calculations run only for these candidates
5. The best driver is selected and the request is dispatched

Enter fullscreen mode Exit fullscreen mode

The city of drivers → H3 spatial filter → small candidate set → expensive routing → best match.


The Two-Stage Design

This is the real architectural insight: cheap filtering first, expensive computation only when necessary.

H3 doesn't measure distance or determine the final match. It dramatically reduces the search space so that the costly operations — real road-network routing, live traffic analysis, driver direction and speed — only run on a handful of drivers instead of thousands.

The closest driver geographically isn't always the fastest. Someone two hexagons away on a clear road might reach you before someone in the same hex stuck in traffic. Uber optimizes for ETA, not straight-line distance. H3 just makes it feasible to get to that calculation quickly.

This two-stage structure also unlocks better infrastructure properties:

  • Caching: hex IDs are stable, so driver locations can be cached by hex
  • Sharding: the grid is predictable, so data can be distributed evenly across servers
  • Horizontal scaling: adding machines doesn't require rethinking the search geometry

The Bigger Idea

H3 is essentially a spatial index — and once you see it that way, the whole system makes sense.

Databases use indexes so queries don't scan entire tables. Uber uses H3 so ride matching doesn't scan entire cities. The hexagonal grid narrows the problem first; precise computation handles the rest.

It's a clean example of a broader principle in system design: defer expensive operations until the problem is small enough to handle efficiently.


Found this while exploring system design rabbit holes. If something's off or you want to go deeper on any part, drop a comment — I'm still learning this stuff.