Ever wonder how a food app loads 40 restaurants in under 2 seconds?
Someone taps a food app. In under 2 seconds, 40 restaurants appear. No one thinks about it. They just scroll and order.
But behind that tap — geo-indexing snaps the location to a hex grid, radius filtering runs the Haversine formula across thousands of restaurants, Redis cache serves results in under 5ms, and latency optimizations shave every unnecessary millisecond off the response.
The whole thing resolves before a human brain even registers it happened.
That is not luck. That is engineering.
Swipe through to see how it actually works.
Read the slides as text
Slide 1
🍕
E N G I N E E R I N G D E E P D I V E
HOW DOES YOUR
FOOD DELIVERY APP
FIND 30–40 RESTAURANTS
INSTANTLY?
No magic. No genies. Just brilliantly engineered
backend systems — and a lot of ☕.
T H E E N G I N E E R I N G S T O R Y ↓
📍 Geo-Indexing
🔵 Radius Filtering
☁️ Cloud Caching
⚡ Latency Optimization
0 1 / 0 9
C O R E S Y S T E M L O G I C
Slide 2
"
YOU TAP. YOU SEE RESTAURANTS.
IN UNDER 2 SECONDS.
There are millions of restaurants registered globally.
You only see the ones near you — right now, in < 2s.
How does that actually work?
📍 Geo-Indexing
🔵 Radius Filtering
☁️ Cloud Caching
⚡ Latency Optimization
These 4 systems work like a perfectly timed relay race. Let's break them
down — one slide at a time.
T H E R E A L Q U E S T I O N
0 2 / 0 9
C O R E S Y S T E M L O G I C
Slide 3
GEO-INDEXING
The World's Smartest Address Book
🗺️
WHAT IS IT?
Every restaurant has GPS
coordinates stored in a spatial
database — PostGIS, Elasticsearch,
or Google S2. Indexed by location,
not by name.
⚡
WHY IT'S FAST
Traditional SQL scans every row.
Geo-indexing uses spatial trees (R-
Tree / QuadTree) to jump directly to
your neighborhood — like GPS, not a
phonebook.
🤯 Fun Fact: Uber Eats uses H3 hexagonal geo-indexing — the same grid
system used for ride matching — to snap your pin to a geo-cell and pull
nearby restaurants in microseconds.
Think of it like city zip codes — but for hexagons. Your pin lands in a hex → all
restaurants in that hex returned instantly. Zero full-table scans.
S T E P 0 1
0 3 / 0 9
C O R E S Y S T E M L O G I C
Slide 4
LOCATION RADIUS FILTERING
01
GPS COORDINATES CAPTURED
Lat + Long sent to server the moment you
open the app — before you type anything.
02 HAVERSINE FORMULA APPLIED
Calculates real-world distance using Earth's
curvature. Typical radius: 3–8 km.
03 SMART SORTING APPLIED
Results ranked by distance, rating, ETA, and
sponsored priority in one pass.
Only restaurants that pass the radius check
ever get ranked. The rest don't exist to your
app. Brutal efficiency.
S T E P 0 2
YOU
0 4 / 0 9
C O R E S Y S T E M L O G I C
Slide 5
CLOUD CACHING
Because querying the DB every time is... expensive 💸
⚡
REDIS CACHE
Restaurant data for a
geo-cell stored in-
memory. Cache hit =
response in under 5ms.
Zero DB query.
☁️
CDN EDGE NODES
Cached data lives at
edge servers near you
— AWS CloudFront,
GCP CDN. Your request
barely leaves the region.
🔄
TTL EXPIRY
Cache expires every 5–
15 min. Prices and
hours refresh from DB
automatically — no
stale data shown.
💡 Real Talk: During peak hours (7–9 PM), up to 90% of requests are served
from cache — saving millions of USD monthly in DB compute costs.
Your app isn't fast because their servers are fast. It's fast because it barely talks
to them. 🤌
S T E P 0 3
0 5 / 0 9
C O R E S Y S T E M L O G I C
Slide 6
KILLING LATENCY
EVERY. SINGLE. MILLISECOND.
T E C H N I Q U E
W H AT I T D O E S
I M PAC T
HTTP/2
Multiplex
Multiple requests over 1 TCP connection
simultaneously
-40% Round
Trips
Lazy Loading
Restaurant images only load when you
scroll to them
-60% Init
Load
Predictive
Prefetch
AI pre-loads restaurants before you even
open the app
Near-Zero Lag
Protobuf
Encoding
Data serialized 3–10x smaller than JSON
over the wire
-70% Payload
🏎️ Combined, these compress what would be a 400ms sluggish response into a
buttery < 80ms experience you never even notice.
S T E P 0 4
0 6 / 0 9
C O R E S Y S T E M L O G I C
Slide 7
THE FULL FLOW: TAP → 40
RESTAURANTS
📱
USER OPENS APP
GPS coordinates captured → lat/long sent to load balancer via
HTTPS/2
0 ms
🗺️
GEO-INDEX LOOKUP
Coordinates snap to H3 hex cell → spatial index returns nearby
restaurant IDs
~5 ms
☁️
CACHE CHECK (REDIS)
Cache hit = return instantly. Cache miss = query DB, store result, then
return
~10 ms
⚡
RADIUS FILTER + RANK
Haversine filter → rank by distance, rating, ETA → serialize via
Protobuf
~30 ms
🎉
RESULTS RENDERED ON SCREEN
40 restaurants. Menus. Ratings. ETAs. All loaded. You pick the
burger place. Again.
< 80 ms
P U T T I N G I T A L L T O G E T H E R
0 7 / 0 9
C O R E S Y S T E M L O G I C
Slide 8
B Y T H E N U M B E R S
THE SCALE THAT MAKES THIS WILD
80
M I L L I S E C O N D S
Average end-to-end response time
from tap to full restaurant list on top
platforms
90%
C A C H E H I T R AT E
Peak-hour requests served from
Redis cache — no database query
needed at all
10x
FA S T E R L O O K U P
Spatial geo-index vs traditional SQL
full table scan on large restaurant
datasets
$1M+
S AV E D M O N T H LY
Estimated DB compute savings for
large platforms leveraging aggressive
caching at scale
0 8 / 0 9
C O R E S Y S T E M L O G I C
Slide 9
🚀
K E Y T A K E A W A Y
NEXT TIME YOU ORDER FOOD,
REMEMBER:
ENGINEERS MADE THAT MAGIC.
Geo-indexing · Radius filtering · Cloud caching · Latency
optimization
4 systems. Under 80ms. Millions of happy — and hungry — users
daily.
SAVE THIS POST
SHARE WITH YOUR TEAM
SystemDesign
TechExplained
BackendEngineering
Found this valuable? Follow for more engineering breakdowns.
0 9 / 0 9
C O R E S Y S T E M L O G I C