ChatGPT
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 ChatGPT: the 60-second story

    Design ChatGPT

    Every answer is a 10-to-30-second stream from the costliest hardware you run.

    It must survive a dropped 4G link and stay fast when 9 pm in India meets the US workday.

    77,000

    GPUs at the evening peak, before headroom

    Assume 100M daily users × 20 messages, 58,000 a second at peak and 23M output tokens a second. New GPUs take months to buy.

    How do tokens reach the phone?

    Bad: Poll every 500 ms

    1.6M mostly empty requests a second at peak, and jerky text.

    Good: SSE over HTTP/2

    One plain HTTP response with event IDs and resume built in.

    Your phone drops from Wi-Fi to 4G mid-answer.

    The orchestrator keeps writing tokens to a per-run Redis log. Reconnect with Last-Event-ID 31, and any gateway replays from 32.

    The model remembers nothing. Every turn re-sends the whole conversation, so cost grows with length squared.

    The trick

    Keep the prompt’s start identical. Cached tokens bill at 0.1× (OpenAI, October 2026), cutting input cost 78%.

    Edit an old message. What happens to the answer?

    Nothing is overwritten. Edits and regenerations add siblings in a tree; one active leaf decides what you see and what the model reads.

    30%

    over capacity, 9:15 pm on launch day

    Demand is 30M tokens/s against 23M. Assume the small model needs a fifth of the GPU time; move free users there and it’s 12M.

    Safety without killing latency

    1. Classify the input before spending any GPU time
    2. Check output every 15 tokens, ≈ 0.65 s behind
    3. On a flag, stop the GPU and retract
    4. Watch accounts and behaviour, not just text

    Remember

    Generation lives in a per-run token log, not the connection. Prompts keep a stable prefix, chats are trees, and fair queues guard scarce GPUs.