</> MAANG.io
system design · 301

Advanced

Master system design interviews with scalable architecture patterns, distributed systems, and real-world design challenges.

0/480 solved 0% complete

Section 9: The Index Is Always Slightly Behind - Deep Dive: Ingestion, Freshness & Indexing

Executive Summary: Sections 7 and 8 assumed the index is correct. This section keeps it correct. We follow a change through entity resolution into PlaceDB, then via CDC and Kafka to every region's indexers. External versioning makes reordering and replays harmless, a low-priority lane isolates bulk loads, and a circuit breaker stops bad feeds. A weekly blue/green rebuild with a validation gate keeps the index honest. The target: edits visible in search at p99 ≤ 5 minutes.

The interviewer turns the page: "Menya Kaze has been dinner-only, opening at 17:00. At 12:02 the owner adds lunch hours from noon. When does Sam see it, and what stops your index from slowly drifting away from the truth?" The second half is the real question: derived copies rot unless something forces them back into line.

Where Changes Come From

The volume is small, about 2M changes a day (~23 writes/s), but the sources differ sharply:

Source Shape Trust Path
Owner portal Single edits (hours, phone, closures) High, verified owner Priority lane, straight to PlaceDB
Provider bulk feeds Millions of rows, hourly or daily Medium; duplicates and errors Entity resolution, throttled ≤ 5,000 writes/s
User-suggested edits "This place closed" Low Moderation queue first
Ops tools Merges, takedowns High, audited Priority lane

Provider feeds need entity resolution before they touch PlaceDB. When a feed sends "Menya Kaze, W 41st St", we look up places within 50 m via Section 5's geohash7 cell and its neighbours, and match on name similarity plus phone number. A hit updates the existing place_id through place_sources; a miss creates a place. Skip this and Sam sees three Menya Kazes, each with a third of the reviews.

Ingestion paths: owner portal, provider feeds on a throttled bulk lane, moderated user edits and ops tools feed the ingest service, which writes versioned transactions to the PlaceDB primary; CDC flows to a 32-partition Kafka topic, mirrored per region to indexers that also read review aggregates every 15 min and write versioned documents to 64 geo shards

Sign in to continue reading

The rest of this lesson is available with a free account. Signing in with Google or Microsoft is free.

Sign in to read the full lesson

Sign in to MAANG.io

Use your Google or Microsoft account — no password to remember.

Continue with Google Continue with Microsoft

Please accept the terms above to continue.