Video in progress

A video streaming service has 1 million concurrent viewers. Estimate the CDN egress traffic and the monthly cost out loud.

If I take an average bitrate of 3 Mbit/s, 1 million viewers is 3 Tbit/s of egress. Taking the average load over the whole day, that comes to hundreds of petabytes a month, so most of the cost is traffic, and the choice of bitrate and codec is directly money.

📖 Answer

I write the assumptions out openly, because in an interview the chain of reasoning is graded, not the number.

  • Concurrent viewers at peak: 1,000,000.
  • Adaptive bitrate: 720p on a phone ~2 Mbit/s, 1080p on a TV ~5 Mbit/s. Average ~3 Mbit/s.
  • Peak egress: 10⁶ × 3 Mbit/s = 3 Tbit/s.

This number gives an immediate conclusion: you can't serve that traffic from the origin. 3 Tbit/s means hundreds of edge servers, several CDNs or your own edge network.

Monthly volume:

  • peak is about 4 hours a day, and for the other 20 hours I assume ~30% of peak on average: 3 × (4/24 + 0.3 × 20/24) ≈ 1.25 Tbit/s average;
  • 1.25 Tbit/s ÷ 8 ≈ 156 GB/s, times ~86,400 s → ~13.5 PB/day, ~400 PB a month.

Cost: if a negotiated price at large volume is, say, $0.005 per GB (the public price list is several times higher), 4 × 10⁸ GB × $0.005 ≈ $2M/month.

Decisions that follow from this math:

  • Codec. Moving from H.264 to HEVC or AV1 cuts the bitrate by 30-50% at the same quality, which is hundreds of thousands of dollars a month. Encoding gets more expensive, but only once.
  • Per-title encoding. Cartoons or static shots fit into a lower bitrate.
  • Default quality. On mobile data 480p is enough, and on a small screen you don't need 1080p.
  • Origin protection. Even with a 95% hit rate, the origin sees 5%, that is ~150 Gbit/s, so an origin shield layer is a must.
  • At very large scale, put your own caches inside the ISPs' networks (like Netflix Open Connect).

At the end I name the most sensitive assumptions: the bitrate and the peak factor. For a live broadcast everyone watches the same content, so the hit rate is very high, but the peak arrives within a minute.