#TVZ
<!-- Generated by <a href="https://www.yinote.co/#installation">YiNote</a> -->
# How does Pokémon Go scale to millions of requests? - YouTube
## [2:20](https://www.youtube.com/?yinotetimestamp=140)
Stack used for Pokémon Go: GCP, GKE
## [3:00](https://www.youtube.com/?yinotetimestamp=180)
5000 Spanner nodes and thousands of GKE nodes
## [3:14](https://www.youtube.com/?yinotetimestamp=194)
microservices setup
## [3:35](https://www.youtube.com/?yinotetimestamp=215)
vs WoW: PoGo doesn't have separate realms - it's essential to the experience that everyone plays in the same world.
## [4:40](https://www.youtube.com/?yinotetimestamp=280)
They used to use Google Data Store, but they switched to Spanner because of consistent indexing
## [7:09](https://www.youtube.com/?yinotetimestamp=429)
architectural diagram
## [7:55](https://www.youtube.com/?yinotetimestamp=475)
Spatial Query backend stores data about the world: which pokémons are out, where pokéstops and raids are. Frontend is responsible for displaying that information to the users. Bigtable is for tracking.
## [8:05](https://www.youtube.com/?yinotetimestamp=485)
[[Google Pub-Sub]] is used for analytics pipeline.
## [8:41](https://www.youtube.com/?yinotetimestamp=521)
They employ a lot of caching to reduce load on servers.
## [9:14](https://www.youtube.com/?yinotetimestamp=554)
10-20GB data generated every day and sent to BigQuery
## [10:09](https://www.youtube.com/?yinotetimestamp=609)
Checking for abuse or location spoofers is a factor in load too
## [10:20](https://www.youtube.com/?yinotetimestamp=620)
Google Data Flow to set up pokéstops and gyms all over the world.
## [10:30](https://www.youtube.com/?yinotetimestamp=630)
Open Street Map, Wayfarer, US Geological Survey
## [10:31](https://www.youtube.com/?yinotetimestamp=631)
Getting location data from Google Street Map and Wayfarer
## [11:12](https://www.youtube.com/?yinotetimestamp=672)
Because BigQuery is serverless, it is able to scale as needed
## [11:38](https://www.youtube.com/?yinotetimestamp=698)
Prometheus and Grafana are used for monitoring (and Google Cloud Monitoring)
## [12:28](https://www.youtube.com/?yinotetimestamp=748)
Google Game Servers?
## Learnings
Unique requirements of Pokémon Go
- Global consistency: all users play on the same realm
- AR game: mix of real data (locations and points of interest) and fictional data (pokémon spawn points and events)
- Everyone plays on mobile devices, and mostly on mobile networks: less reliable internet connection
- Events are timed
- Analytics are the point (for Google and Niantic)
- Cheating via location spoofing needs to be detected and avoided, otherwise it breaks the game
How do they scale Pokémon Go?
- [[Event-driven architecture]]: Rather than doing a constant poll to see whether there is new data, they use a pub/sub model to reduce redundant requests
- [[Microservices|Microservices-based]]: Scaling the entire stack would be unnecessarily expensive; using microservices means they can scale individual components or services separately.
- Cloud Spanner instead of Google Data Store because of availability and global consistency.
> Under external consistency, the system behaves as if all transactions were executed sequentially, even though Cloud Spanner actually runs them across multiple servers (and possibly in multiple datacenters) for higher performance and availability. In addition if one transaction completes before another transaction starts to commit, the system guarantees that clients can never see a state that includes the effect of the second transaction but not the first. Intuitively, Cloud Spanner is semantically indistinguishable from a single-machine database. [Source](https://cloud.google.com/spanner/docs/true-time-external-consistency)
- They offload as many of the static assets that they can to each user's mobile
- They employ a lot of caching
- Events are staggered and happen in the user's timezone.
- Prometheus, Grafana, Google Cloud Monitoring used
- Google Game Servers