Skip to content
SD-26 · System design

Design a Concurrent Stream Limits

Asked at Senior level45 minutes
Our answers stay hidden until you reveal them.

Design the part of a video streaming service that limits how many screens each account can watch at once. A basic plan allows 1 stream, a standard plan 2 and a premium plan 4. When a member presses play on a fifth TV, the service says which devices are watching and lets them stop one. When a player is closed, or the TV is unplugged, its slot must come back on its own.

The service has 250 million accounts and about 40 million streams at the evening peak. Every playing device checks in regularly, so the check-ins, not the starts, are most of the load: about 700,000 requests a second. The hard parts are counting correctly when two TVs start in the same millisecond, releasing slots of players that crash without saying goodbye, and never blocking a paying member just because our counting system has a bad minute.

Good questions to ask first

Decide what you would assume for each before you look at ours.

  1. 1What are the limits?
  2. 2What happens at the limit?
  3. 3How fast must a slot come back after a crash?
  4. 4Does pausing hold a slot?
  5. 5Does the same device restarting count twice?
  6. 6Is it exact?
  7. 7What about members abroad?
  8. 8How fast does a plan change apply?

How to spend the 45 minutes

  1. 5minPart 1: Requirements and scope
  2. 5minPart 2: Estimates
  3. 5minPart 3: API
  4. 15minPart 4: Architecture, stage by stage
  5. 15minPart 5: Deep dives and trade-offs
Sketch your own design: boxes, arrows and the numbers that matter. Then compare it with ours.Break it in the labVisual walkthrough