educative.io

Educative

Why Yelp needs 8 bytes of LocationID

The lecture of Designing Yelp says “Although a four bytes number can uniquely identify 500M locations, with future growth in mind, we will go with 8 bytes for LocationID.”
I don’t get the math behind it. I think 4 bytes, 32 bits can represent over 4 Billion combinations.
So why do we need such a long field to store 500M locations?
Do I miss anything?

Let’s build our system assuming that we have 500M places and 100K queries per second (QPS). Let’s also assume a 20% growth in the number of places and QPS each year.

We will exceed it in 12 years :slight_smile:

1 Like

“Let’s build our system assuming that we have 500M places and 100K queries per second”.

Google Search is running at 63K QPS in 2021. Surely Yelp is processing an order of magnitude less QPS than Google, if not two orders of magnitude. 100K QPS doesn’t make sense…

+1 100K is overestimated