Dating App (Tinder)
Requirements: create a profile with preferences (age, distance, gender); get a stack of nearby candidates; swipe left/right; a match when both swiped right (notify both instantly); never show the same profile twice.
Estimates: 20 M DAU × 100 swipes/day = 2 B swipes/day ≈ 25k swipes/s (peaks 3–5×).
feed: client -> feed svc -> candidate generation: geo + filters (Elasticsearch geo_distance / geohash index)
-> drop already-swiped (per-user swiped set / Bloom filter) -> rank -> cached stack (Redis)
swipe: client -> swipe svc -> swipes store (Cassandra, partition = swiper_id)
-> right swipe? atomic check of the reverse swipe -> match -> matches DB + push notification
Deep dives
- Match consistency: A and B may swipe right on each other at the same moment. Store the pair under one key (
min(A,B):max(A,B)) and update it atomically (Redis Lua script or a single-partition conditional write) so exactly one of the two swipes creates the match. - Feed generation: precompute a stack of ~100–200 candidates per user (batch + refresh when the user moves or the stack runs low) so swiping is instant; ranking blends distance, activity, mutual-interest likelihood.
- Avoid repeats: check candidates against the user's swipe history; a per-user Bloom filter keeps it cheap (a rare false positive just hides one profile).
- Location updates are infrequent and only update the user's geo document; privacy: show rounded distances.