System Design: Yelp (Walnut Spots: Nearby Search, Geohash Cells, Open Now, Fair Ratings, Reviews, Fake-Review Rings)
We design a service for finding places nearby and reading their reviews, like Yelp, and call it Walnut Spots.
A person opens the app, types "ramen" and taps "open now". Walnut Spots shows the best open ramen places near them, in a fair order. People also write reviews, add photos, and owners keep their hours right.
The hard part is not storing places. It is finding the near ones fast, deciding what is open in each place's own time zone, and keeping ratings honest when some reviewers lie.
As in any system design interview, every number here is our own assumption for planning, and the design is our own.
All times are local, with the time zone named. All businesses and IDs in the story are made up; the cities and streets are real.
How to read this post. It takes about 62 minutes in full, so it is built to be read in parts:
1. Requirements
1.1 What we are building
Walnut Spots does four jobs:
- Find places near a person. Search near a point with words and "open now", and answer in under half a second.
- Order them fairly. Put good, close places first. A place with two 5-star reviews must not beat one with a thousand good ones.
- Keep reviews honest. One review per person per place, counts that stay right through retries and edits, and fakes kept out of the rating.
- Stay current. New hours, a new review or a closed place show in search within minutes.
The story. It is the week of Friday 6 November 2026, mostly in New York.
- Mon 2 Nov to Thu 5 Nov. A group called StarFarm posts 38 fake 5-star reviews of a Manhattan dentist from 40 accounts. A nightly job finds the group on Thursday at 02:00.
- Fri 6 Nov, 19:05 Eastern. Maya Johnson leaves work in Williamsburg, Brooklyn. She types "ramen" and taps "open now". About 180 ms later Kumo Ramen, 251 m away, is first.
- 19:20. One data center building in our East region loses power. Marcus Lee, our on-call engineer, watches searches move to the other buildings.
- Sat 7 Nov, 21:14. Olivia Martinez reviews Kumo Ramen: 3 stars, with 2 photos. Her phone loses Wi-Fi and sends the review twice.
- Sun 8 Nov, 08:10 Central. Ethan Brooks searches "coffee" in Marfa, a small desert town in Texas. The search widens until it finds three places.
- Tue 10 Nov, 10:02. Daniel Kim sets special New Year's Eve hours for his Kumo Ramen.
- Thu 31 Dec. Crowds fill Times Square for New Year's Eve. Searches from one small square of the map jump to 800 a second.
What happens to each person:
- Maya sees open ramen places near her, closest good ones first, in about 180 ms.
- Olivia's review is stored once, though it arrived twice, and Kumo's rating moves by exactly one review.
- Ethan gets three coffee places instead of an empty page.
- Daniel's holiday hours are right on Kumo's page within seconds, and in search within minutes.
- The dentist's rating loses every fake within 5 minutes of the nightly job.
- Marcus does nothing during the power loss: no search fails for more than a minute.
The hard part has four sides:
- Map codes hide closeness. Maya and Kumo Ramen are 251 m apart, yet their map codes share only 4 of 6 letters.
- Density differs. A Brooklyn block holds dozens of ramen places; a desert county may hold one coffee shop.
- Each place has its own clock. "Open now" depends on its time zone, hours past midnight and holidays.
- Reviewers are people. Some lie, retry, edit or delete. The counts must stay right after each.
1.2 Words we use
Places and maps:
| Word | Meaning here |
|---|---|
| Point | One latitude and longitude, such as where Maya stands |
| Radius | How far from the point we search |
| Business | A place people can visit, with its record: name, point, categories, hours |
| Geohash | A short text code for a square of the map. Nearby places often share its first letters |
| Cell | All the points that share one geohash code, such as dr5rsg |
| Neighbor cells | The 8 cells around a cell |
| Geoshard | One part of the search index: every business in a group of areas |
| Open now | Open at the moment of the search, by the business's own clock |
| Special hours | Hours for one date, such as New Year's Eve, that replace the weekly hours |
Reviews and ratings:
| Word | Meaning here |
|---|---|
| Review | One person's 1 to 5 stars and text about one business |
| Rating counts | A business's number of counted reviews at each star level |
| Bayesian average | An average that starts from 10 imaginary reviews at the local average, so a place with few reviews stays near it |
| Recommended | A review that passed the fraud checks: shown and counted |
| Not recommended | A review that failed them: readable on a separate page, not counted |
| Review ring | A group of accounts that one party runs to post fake reviews |
| Owner | A person who has proven they run the business |
| Sponsored result | A paid result, always labeled as paid, in its own place on the page |
Our servers:
| Word | Meaning here |
|---|---|
| Search engine | A store built for searching by area, words and filters at once, such as Elasticsearch |
| Geo tree | A tree inside the Search engine that sorts points by area, so it finds the ones inside a circle |
| Replica | A copy of a store or of the index on another server |
| Primary | The one replica of a store shard that takes writes |
| CDN | Servers in many cities that keep copies of files near people, run by an outside company |
| Outbox row | A row written in the same transaction as a change, to announce that change |
| Request ID | A random ID the app makes for each write, and repeats on every retry |
| Region | One of our two groups of data centers: East in Virginia, and West in Oregon |
| Zone | One building or group of buildings inside a region, with its own power |
| p50, p99 | The time that half, or 99 of every 100, requests finish within |
IDs in the story:
| ID | What it names | Example from the story |
|---|---|---|
| u_48213 | A user ID | Maya Johnson |
| u_77105 | A user ID | Olivia Martinez |
| biz_7Hq2Kd | A business ID | Kumo Ramen, at 40.7155, -73.9590 |
| rv_3Fp9Q | A review ID | Olivia's review of Kumo Ramen |
| req_c41e | A request ID | The ID her app sent twice |
| bs-17 | A Business store shard | The slice that holds Kumo Ramen |
| gs-nyc | A geoshard | The part of the search index for New York |
1.3 Every kind of request and change
Each kind comes in at a different rate and is handled by different parts. Every row is covered by a stage or a deep dive.
| Kind | What it is | How big or how often | Part that handles it | Outside company that takes part |
|---|---|---|---|---|
| Search | Places near a point or in a place, with words and filters | 10,000 a second at design capacity | Search service, Search engine | none |
| Business page | Details, hours, rating, reviews, photos | 7,000 a second at design capacity | Business service, Business cache | A CDN company, for signed-out pages |
| Review | Post, edit or delete one review | 1 a second on average, 20 at design capacity | Review service | none |
| Fraud check | Decide if a review counts | one per new review or edit | Trust service | none |
| Helpful vote | A vote on a review | about 6 a second | Review service | none |
| Listing change | New hours, a move, a closure | about 5 a second | Business service | none |
| Photo | Upload, clean and check one photo | 300,000 a day | Photo service, Media pipeline | none |
| Sponsored result | A paid place in its own labeled slot | on most searches | Ads service | none |
1.4 Functional requirements
- Search nearby. Search near a point or in a named place such as "Brooklyn". Add words and filters such as price and "open now".
- Order results. Order by how well each place fits, a fair rating and distance. Show sponsored results in labeled places.
- Business page. Show details and hours, photos, the rating and reviews.
- Post a review. One review per person per business, with 1 to 5 stars, text and photos. Edit and delete it.
- Read reviews. Sort by newest, highest, lowest or most helpful. Vote a review helpful. Owners reply.
- Keep fakes out. Keep fake and paid reviews out of the rating.
- Owner changes. Owners prove they run a business and change its details and hours. Changes reach search fast.
- Photos. Upload photos, remove their location data, and check them.
- Pages of results. Page through results in a stable order.
- Delete my data. Delete a person's reviews and photos on request.
Out of scope: a personal home feed, bookings, and the ad auction and billing. So are map tiles, and food trucks or anything that moves.
1.5 Non-functional requirements
- Search speed. 150 ms at p50 and 400 ms at p99 when the cache misses; 100 ms at p99 when it hits.
- Capacity. 10,000 searches and 7,000 business page views a second; 20 new reviews a second.
- One review. The store itself refuses a second review by the same person of the same business.
- Counts. Rating counts always match the counted reviews. A retried request changes them at most once.
- Fresh. A closure or move in search within 30 seconds; other changes and new ratings within 2 minutes at p99. A cached list may add a place up to about 7 minutes late, but drops one at once.
- Open now. Right at the moment of the search, in the business's own time zone, with special hours.
- Durable. A saved review survives the loss of a zone, and of a region while the link to West works.
- Available. Search works 99.95% of a month; a cached or simpler answer counts.
- Private. No exact user point in logs, cache keys or analytics.
1.6 The numbers
| Number | How we get it | Result | What it decides |
|---|---|---|---|
| Searches a day | 50 million daily users × 5 searches, pages or map moves | 250 million a day, about 2,900 a second | The average we plan from |
| Dinner hour | 18:00 to 20:00 local across four US time zones, about 3 times the average | About 8,700 a second; we plan for 10,000 | Search runs on its own servers, sized for dinner |
| Business pages | 50 million users × 4 pages a day ÷ 86,400 × 3 | About 7,000 a second at dinner | Pages come from a cache of business cards |
| Writes | Votes 6 + listing changes 5 + reviews 1 a second | About 12 a second | 10,000 searches ÷ 12 writes = about 800 reads per write at dinner, so a search index apart from the store |
| Reviews | 30 million a year ÷ 365 ÷ 86,400 | About 1 a second; we plan for 20 | One relational store is enough for writes |
| Listings | 30 million open + 10 million closed, kept for name search | 40 million | The index size |
| Search index | 40 million × 2.5 KB | About 100 GB a copy | Split by area into 8 geoshards, so each fits a server's memory |
| Reviews stored | 350 million × 2 KB | About 700 GB | 32 shards for size and recovery time, not for writes: about 22 GB each |
| Photos | 300,000 uploads a day × 3 MB | About 0.9 TB a day | Straight to object storage, never through our servers |
What these numbers tell us. Writes are few: about 12 a second. The hard parts are elsewhere:
- 10,000 searches a second that each filter by area and words at once, then rank;
- "open now" worked out for each place in its own time zone, at the moment of the search;
- counts that stay exact while fraud checks change which reviews count.