Alex Xu V2 - 3 Google Maps

TLDR

Helps users navigate to their destinations

Step 1 - Clarify and Scope Problem

How many users do we expect?

Should our system take traffic conditions into consideration?

How about different travel modes? Biking, walking, etc.

Should it support multi-stop directions?

How about business places and photos? How many photos are we expecting?

Functional Requirements

Update user location Navigation Service -> ETA Service Map Rendering

Non-Functional Requirements

Make sure it’s available and scalable Okay for there to be slight delays in data Accuracy -> Users can’t be given the wrong directions Data and battery usage -> Should be minimized Smooth map rendering

Useful Concepts for Google Maps

Map 101

Back of Envelope Estimation

Need to store map of world Metadata for each map tile -> Negligible for each map tile All roads in world (TBs)

Map of world

Server Throughput / Load

Two types of requests

1 Billion DAU Let’s say each user uses 30 minutes per week of navigation 35B minutes per week or 5B minutes per day Send location updates every second?

What does he mean by Batch requests? Combine them?

Assume QPS peak is 5x th eaverage -> 200,000 x 5 = 1 million

Step 2 - Propose High Level Design and Get Buy-In

![[Screenshot 2024-02-10 at 10.49.50 AM.png]]

We have a ton of writes, so the database should be something with high-write ability

Can log location data using Kafka too for further processing

HTTP works for a communication protocol. It’s straightforward and has “keep-alive”

Finding shortest / fastest path from A to B

Map Rendering

Option 1

Option 2

Data-usage of user estimation

CDN usage

Can have the client geohash their location and then send to our servers to retrieve their needed map geohash

Step 3 - Design Deep Dive

Data Models

Routing Tiles

User Locations

ETA Service

Get a list of shortest possible paths

Use machine learning ot predict ETA based on current traffic and historical data

Rank these outputs, filter them (No tolls, etc.)

![[Pasted image 20240503131626.png]]

Map Rendering

Need more reading….

![[Pasted image 20240503131657.png]]