Tinder
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Design Tinder: the 60-second story

    Design Tinder

    One photo, a swipe, and sometimes “It’s a match!”

    Behind the card sit a location-aware search, billions of swipes a day, and a match that must never be missed or counted twice.

    70k/s

    swipes a second on a Sunday evening

    Assume 50M daily users swiping about 40 cards each. That’s 2 billion swipes a day, 23k a second on average, three times that at peak.

    Where does the search run?

    Bad: One global index

    A query from Pune searches documents from Peru, on every replica.

    Good: Geoshards, balanced by load

    Ask only the two or three geoshards your circle covers.

    Shards hold equal load, not equal area

    Walk S2 cells along a Hilbert curve and pour in each cell’s load. When the next cell would overflow, seal the geoshard.

    Search, filter, check the seen-set and rank on every fetch? That’s 400–600 ms at p99.

    The trick

    Build decks ahead, 200 ranked IDs per user in Redis. Each fetch pops 25, well under 50 ms.

    12 KB

    per user to remember 10,000 swipes

    An exact set needs 320 KB each, 16 TB for 50M users. A Bloom filter at 1% needs 600 GB, and it never repeats a face.

    Both swipe right in the same 50 ms

    Two rows, check then write, and both see “no”, so the match is lost. One row per pair, and only the second upsert sees both flags.

    Tell Rohan within 2 seconds

    1. Presence maps Rohan to his gateway node
    2. Send the match down his WebSocket
    3. No socket, or no ack in 3 s? Push
    4. Dedupe by match ID; sync on reconnect

    Remember

    Shard search by load, not area. Build decks ahead, skip seen faces with a Bloom filter, match on one atomic row per pair, and notify over sockets.