News · New this week

Google Maps traffic: how it spots jams before you do

The sensors are the phones of drivers ahead of you. A queue, some servers and a model turn their pings into green and red roads.

Cameras are not the main source of Google Maps traffic data. The phones of drivers ahead of you are. Each one acts as a sensor, and Maps mostly listens to them.

That's a system design problem more than a mapping one. The flow has five nodes, and each exists for a clear reason.

Phones send pings

Each phone sends a tiny anonymous ping with two things in it, location and speed. That's all the system needs to know about one driver at one moment.

One ping tells you very little. The value comes from having many of them on the same stretch of road.

Why a queue comes first

Millions of pings land at once. Think of Tatkal booking opening, where everyone hits the system in the same minute. One computer taking that load would crash.

So the pings go into a queue, a waiting line that holds the rush. That's the first thing that would break, and the queue is the answer to it.

How servers spot a jam

Servers read the queue together. Their job is to match each ping to a road.

Once pings are grouped by road, the rule is simple. Many slow pings on one road mean a jam.

From a jam now to your ETA

Knowing there's a jam right now isn't enough. You want your ETA, the estimated time of arrival, and that is more than today's speed on the road ahead.

This is where a model comes in. A model is a program that learns from history. It might learn that a particular road crawls at six p.m. Live speeds from the servers plus those old patterns give your ETA.

The result lands on your map as green or red roads, with the ETA alongside.

What to take from it

The whole flow reads left to right. Phones ahead, then a queue, then servers matching pings to roads, then a model, then your map. Mostly, Maps listens to drivers ahead.

If you're designing anything that takes bursts of small events, try sketching it with the same five nodes. Ask what breaks first when everything arrives at once. In this design, the queue is the answer.

  • #googlemaps
  • #systemdesign
  • #trafficjam
  • #etaprediction

More reels

All news →