Design Twitch Concurrent Viewer Counts for Millions of Live Streams

Last updated: November 29, 2026

Quick Overview

Design the service that computes and displays the live concurrent viewer count for every Twitch stream, updated every few seconds, and feeds the same counts into directory ranking.

Amazon
System Design
Software Engineer
Amazon
November 29, 2026
Software Engineer
System Design Round
System Design
Hard

0

0

0 solved


Design the service that computes and displays the live concurrent viewer count for every Twitch stream, updated every few seconds, and feeds the same counts into directory ranking.

Twitch is part of Amazon, and this question tests aggregation of very high-rate presence signals with bounded staleness. The interviewer pushes on how you count viewers without double counting, how you handle a single stream with millions of viewers, and how you resist inflated counts from bots.

What the Interviewer Expects
  • Define what counts as a viewer (heartbeat from an active player)
  • Aggregate heartbeats in a sharded, windowed way
  • Handle hot streams without a single counter becoming a bottleneck
  • Serve counts cheaply to millions of readers
  • Separate raw counts from fraud-filtered counts
Key Topics to Cover
Stream Aggregation
Sharded Counters
HyperLogLog
Caching
Fraud Detection
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How would you detect and discount view-botting?
  • Exact distinct counts versus HyperLogLog: when is the error acceptable?
  • How do you produce historical peak and average viewers for creator analytics?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Functional: show viewers now for each live stream, refresh about every 10 to 30 seconds; directory sorts by it; creator dashboard shows history. Non-functional: on the order of 3 to 5 million concurre...

High-Level Design

Players send heartbeats (session_id, user_or_device_id, channel_id, ts) to an edge Ingest service, which writes to a Kinesis or Kafka stream partitioned by hash(channel_id, session_id) mod N so a ...


Submit Your Answer
Markdown supported