Design Google Maps (High-Level Design)
High-level design of Google Maps: pre-rendered map tiles served from a CDN, the road network as a weighted graph with precomputed shortcuts for routing, and live traffic/ETA built from aggregated user location pings via a streaming pipeline.
🔴 High-Level Design · Case Study · Super-senior
"Design Google Maps" is one of the meatier system-design questions because it's really three systems: serving the map itself, routing from A to B, and computing ETAs with live traffic. Each has a beautiful core idea. You won't build all of it in 45 minutes — the skill is scoping to the interesting parts. Let's design it.
Step 1 — Requirements
- Functional: render the map at any zoom/pan; search a place; get driving directions A→B; show ETA with current traffic; reroute on the fly.
- Non-functional: low latency (map + route feel instant), massive read scale, mostly static map data, fresh traffic data.
Step 2 — Serving the map: tiles
🟠You don't send the whole world's map — you send tiles. The map is pre-rendered into square image (or vector) tiles at each zoom level; the client requests just the tiles in view. Because map data changes rarely, tiles are perfectly CDN-cacheable — the vast majority of traffic never hits your servers. This alone handles the "how do you serve billions of map views?" part.
Step 3 — Routing: the road graph
🔴 Model the road network as a graph: intersections are nodes, road segments are edges weighted by travel time. Directions = shortest path.
Classic Dijkstra works but is too slow on a continent-sized graph at query time. Real systems precompute — contraction hierarchies or partitioning add "shortcut" edges so a query explores far fewer nodes, or A* uses straight-line distance as a heuristic to head toward the goal. Partition the map into regions and route hierarchically (local roads → highways → local roads). "Precompute shortcuts so queries are near-instant" is the senior insight.
Step 4 — Traffic & ETA
🔴 Here's the elegant part: the traffic data comes from the users. Phones running Maps send anonymised location pings; aggregating speeds on each road segment gives real-time traffic, which becomes the edge weight. So routing and ETA use live-weighted edges. Feed pings through a streaming pipeline (a queue + stream processor) that updates per-segment average speed every minute. ETA = sum of (segment length ÷ current speed) along the route, adjusted by historical patterns for the time of day.
Step 5 — Geospatial lookups & scaling
🔴 "What's near me?" and "which segment am I on?" need a geospatial index — geohash, quadtree, or Google's S2 cells — to map lat/long to a region quickly (the same primitive behind Uber). Scale by: CDN for tiles, geo-sharding the graph and traffic data by region, caching popular routes, and precomputing shortcuts offline. Map/road data updates run as batch jobs, not live writes.
The interview-ready walkthrough
"Three subsystems. Map: pre-rendered tiles served from a CDN — cheap and cacheable. Routing: the road network as a weighted graph; I'd avoid plain Dijkstra at query time and use precomputed shortcuts (contraction hierarchies) or A*, plus hierarchical routing over map partitions. Traffic/ETA: aggregate anonymised location pings from users through a streaming pipeline into per-segment speeds that weight the graph edges. A geospatial index (S2/geohash) handles nearby lookups, and I'd geo-shard and cache popular routes." Scoping to tiles + graph + traffic hits exactly what they want."
What to read next
- Design Uber — geospatial indexing & matching in depth
- CDN · Message Queues — tiles & the traffic pipeline
- Design Instagram — another read-heavy, CDN-fronted system
- ← The complete System Design guide (hub)