Push vs pull
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.

    Push vs pull architecture: the 60-second story

    Push vs pull

    The hawker brings the paper. Your neighbour walks to the stall.

    Push must track every subscriber, and papers pile up while you’re away. Pull keeps no list, but some walks are wasted.

    One question decides it. Who starts each transfer?

    Push lets the producer send when data exists, at its pace. Pull lets the consumer ask when ready. Whoever doesn’t set the rate can be overwhelmed.

    95%

    of polls come back empty

    1M users polling every 30 s make 33,333 requests a second. If data changes every 10 minutes, 19 of 20 polls find nothing.

    Real-time, so push always wins?

    Bad: Push everything

    1M idle tabs get every like: worse than polling each minute.

    Good: Compare the rates

    Push wins when data changes less often than it’s checked, and freshness matters.

    Kafka consumers pull, so a slow one falls behind, not over.

    With push, a slow consumer gets “a denial of service attack, in essence”. With pull it builds lag and catches up later, in batches.

    One post, 10M followers. Pushing it into every timeline takes 10 s of all fan-out capacity.

    The trick

    So feeds split by author. Push for most accounts; pull the few huge ones at read time.

    Push a signal, pull the data, reconcile with a periodic pull.

    Notifications can be dropped or throttled, so the app pulls on open. The push is a hint; the pull is the truth.

    Pull’s trap: synchronised herds

    1. 50,000 agents every 60 s average 833 a second
    2. All fire on the minute? 50,000 at once, 60×
    3. Add jitter, and answer unchanged polls with a cheap 304

    Remember

    Ask who starts the transfer. Push for freshness to connected consumers; pull for pace, offline catch-up and replay. At scale, the push is a hint; the pull is the truth.