Design of Google Maps

Demystify the high-level System Design of a map application like Google Maps. Define the core services, including route finder, graph processing, and Kafka pub-sub, and analyze their workflow for calculating optimal paths and handling real-time user navigation.

High-level design

We divide the high-level design into two parts: the required components and the workflow connecting them.

Components

The design utilizes the following components:

  • Location finder: Identifies the user’s current location (latitude and longitude) to display on the map.

  • Route finder: Calculates the path between a source and a destination for navigation.

  • Navigator: Tracks the user’s journey in real-time. If the user deviates from the optimal path, this service sends updated directions and notifications.

  • GPS/Wi-Fi/Cellular technology: Technologies used to determine the user’s physical position.

  • Distributed search: Maintains an index mapping place names to coordinates. It searches user-entered keywordsSee Distributed Search for details. to locate places on the map.

  • Area search service: Coordinates between the distributed search and graph processing services. It requests coordinates to define a map area spanning the source and destination, then limits the search scope to this subgraph to optimize performance.

  • Graph processing service: Runs shortest-path algorithms on the subgraph defined by the area search service to determine the optimal route.

  • Database: Stores road network data as a graph. We use a graph database like DataStax Graph.

  • Pub-sub system: Listens for events to trigger services. For example, if a user deviates from a path, it triggers the area search service to recalculate the route. It also collects location data streams for traffic pattern analysis. We use Kafka.

  • Third-party road data: External road network data, preprocessed into a unified format for graph construction.

  • Graph building: Constructs the graph using data from third-party sources or user inputs.

  • User: The person or program interacting with the map system.

  • Load balancer: Distributes user requests across servers.

The illustration below shows how these components connect.