Sub topic 2
Estimating storage, bandwidth and compute
Capacity estimation turns the requirements into numbers: how much storage, network and CPU the platform needs. This chapter assumes you know the basics of object storage, HTTP caching and queues. It also assumes you can read short Python snippets. The ladder and segment length come from later chapters. Here they are inputs.
Why estimate at all
An estimate does not predict the future. It shows which resource dominates the design and which assumption moves the answer most. For video, the usual result is that egress (data leaving your network to viewers) dominates cost and architecture. Storage is large but cheap per byte. Transcoding is bursty and CPU-heavy but can be queued.
The method has four steps:
- State assumptions explicitly, with units.
- Convert everything to a per-second or per-day figure.
- Apply a peak factor, because capacity must cover the busiest hour, not the average.
- Sanity-check against a known reference, such as the cost of a single machine or link.
The assumptions
These numbers are illustrative. Replace them with your own data as soon as you have it.
| Input | Value |
|---|---|
| Uploads per day | 100,000 |
| Average video length | 10 minutes (600 s) |
| Average source bitrate | 8 Mbps |
| Ladder | 360p at 0.8 Mbps, 720p at 3 Mbps, 1080p at 6 Mbps |
| Daily active users (DAU) | 10 million |
| Watch time per user | 1 hour per day |
| Average delivered bitrate | 3 Mbps |
| Peak factor | 3 times the daily average |
| CDN cache hit ratio | 95% |
| Segment length | 4 seconds |
Two units cause most arithmetic errors. Bitrates are in bits per second, while storage is in bytes, so divide by 8. Network capacity is quoted in bits, and storage in bytes.
Storage
Video size is bitrate multiplied by duration. One day of uploads contains 100,000 × 600 s = 60 million seconds of video.
- Source files: 60,000,000 s × 8 Mbps = 4.8 × 10^14 bits, which is 60 TB.
- Renditions: the ladder sums to 0.8 + 3 + 6 = 9.8 Mbps. That gives 60,000,000 × 9.8 Mbps = 5.88 × 10^14 bits, or 73.5 TB.
The platform adds about 133.5 TB per day, or roughly 48.7 PB per year. Three things adjust this figure:
- The ladder costs more than the source. Renditions here take 22% more space than the original. A richer ladder or extra codecs such as HEVC or AV1 add a full copy each.
- Replication. Managed object storage hides replication in its price. If you run your own storage, multiply by the replication factor, for example 3.
- Retention. You may keep the source forever for re-encoding, but delete rarely watched renditions. Tiering cold content to cheaper storage cuts the bill without changing the totals above.
Metadata is negligible by comparison. At about 2 KB per video, 100,000 videos add roughly 200 MB per day. The object count is what matters. With 4-second segments, a 10-minute video has 150 segments per rendition. Three renditions give 450 segment objects plus manifests. That is about 45 million objects per day, or 16 billion per year. Check the per-object costs and request limits of your storage service.
Egress bandwidth
Viewing drives egress. Total viewing is 10 million DAU × 3,600 s = 3.6 × 10^10 seconds per day.
- Bits per day: 3.6 × 10^10 × 3 Mbps = 1.08 × 10^17 bits, which is 13.5 PB per day.
- Average rate: 1.08 × 10^17 / 86,400 = 1.25 Tbps.
- Peak rate: 1.25 Tbps × 3 = 3.75 Tbps.
Compare this with upload. Source ingest is 60 TB per day, about 5.6 Gbps on average. Egress is roughly 225 times larger, so the system is read-heavy. This is why the CDN sits at the center of the design.
Concurrency gives a second view. The average number of concurrent viewers is 10 million hours / 24 hours ≈ 417,000. At peak it is about 1.25 million. Multiply by 3 Mbps and you get the same 3.75 Tbps.
Request rate and origin load
Each player fetches one segment per segment duration. At peak:
- Edge requests: 1,250,000 viewers / 4 s ≈ 312,500 requests per second.
- A 720p segment at 3 Mbps is 1.5 MB, so segments are large enough that request rate is rarely the limit. Bandwidth is.
A 95% cache hit ratio means 5% of traffic reaches the origin:
- Origin bandwidth at peak: 3.75 Tbps × 0.05 = 187.5 Gbps.
- Origin requests at peak: 312,500 × 0.05 ≈ 15,600 per second.
Transcoding compute
Compute is measured in vCPU-seconds per second of video. These costs depend on codec, preset and resolution, so benchmark them on your own content. We assume the H.264 medium preset from the earlier ffmpeg example:
| Rendition | vCPU-seconds per second of video |
|---|---|
| 360p | 0.5 |
| 720p | 2 |
| 1080p | 4 |
| Total | 6.5 |
- Work per day: 60,000,000 s × 6.5 = 3.9 × 10^8 vCPU-seconds, about 108,000 vCPU-hours.
- Average: 3.9 × 10^8 / 86,400 ≈ 4,500 vCPUs busy all day.
- At a 3× peak: about 13,500 vCPUs, or around 1,700 machines with 8 vCPUs.
Unlike egress, transcoding sits behind a queue, so you can choose between two sizing strategies:
- Provision for the average and accept longer queue times at peak.
- Provision for a latency target, such as "published within 10 minutes of upload", and scale workers with queue depth.
Splitting a source into chunks and encoding them in parallel lowers the latency of a single upload without changing the total CPU work. Newer codecs compress better but usually cost several times more CPU, so they are often applied only to popular titles.
A calculator you can run
Keeping the estimate in code makes assumptions easy to change and re-check.
SECONDS_PER_DAY = 86_400
# Assumptions (change these first)
uploads_per_day = 100_000
avg_duration_s = 600
source_bps = 8_000_000
ladder_bps = {"360p": 800_000, "720p": 3_000_000, "1080p": 6_000_000}
encode_vcpu_s = {"360p": 0.5, "720p": 2.0, "1080p": 4.0}
dau = 10_000_000
watch_s_per_user = 3_600
avg_delivered_bps = 3_000_000
peak_factor = 3
cache_hit_ratio = 0.95
segment_s = 4
def bits_to_tb(bits):
return bits / 8 / 1e12
video_s_per_day = uploads_per_day * avg_duration_s
# Storage
source_tb = bits_to_tb(video_s_per_day * source_bps)
renditions_tb = bits_to_tb(video_s_per_day * sum(ladder_bps.values()))
daily_tb = source_tb + renditions_tb
# Egress
egress_bits_day = dau * watch_s_per_user * avg_delivered_bps
avg_tbps = egress_bits_day / SECONDS_PER_DAY / 1e12
peak_tbps = avg_tbps * peak_factor
origin_peak_gbps = peak_tbps * (1 - cache_hit_ratio) * 1000
# Concurrency and request rate
peak_viewers = dau * watch_s_per_user / SECONDS_PER_DAY * peak_factor
edge_rps = peak_viewers / segment_s
origin_rps = edge_rps * (1 - cache_hit_ratio)
# Compute
vcpu_s_day = video_s_per_day * sum(encode_vcpu_s.values())
avg_vcpus = vcpu_s_day / SECONDS_PER_DAY
peak_vcpus = avg_vcpus * peak_factor
print(f"Storage added per day: {daily_tb:.1f} TB "
f"(source {source_tb:.1f}, renditions {renditions_tb:.1f})")
print(f"Egress per day: {egress_bits_day / 8 / 1e15:.1f} PB")
print(f"Egress average {avg_tbps:.2f} Tbps, peak {peak_tbps:.2f} Tbps")
print(f"Origin peak: {origin_peak_gbps:.1f} Gbps")
print(f"Peak viewers: {peak_viewers:,.0f}")
print(f"Edge requests/s: {edge_rps:,.0f}, origin requests/s: {origin_rps:,.0f}")
print(f"Transcode vCPUs: average {avg_vcpus:,.0f}, peak {peak_vcpus:,.0f}")It prints:
Storage added per day: 133.5 TB (source 60.0, renditions 73.5)
Egress per day: 13.5 PB
Egress average 1.25 Tbps, peak 3.75 Tbps
Origin peak: 187.5 Gbps
Peak viewers: 1,250,000
Edge requests/s: 312,500, origin requests/s: 15,625
Transcode vCPUs: average 4,514, peak 13,542Common errors
- Mixing bits and bytes. An 8× error is the most frequent mistake. Write units on every line.
- Using the average instead of the peak. Links and origins fail at the peak, not the mean.
- Treating DAU as concurrent users. Concurrency is watch time spread over the day, then multiplied by the peak factor.
- Assuming the delivered bitrate equals the top rendition. Most viewers sit on middle rungs. Measure the real distribution once you have playback data.
- Forgetting the long tail. Total library size, not just daily uploads, determines storage cost and cache behavior.
- Ignoring rewatch and abandonment. Viewers who leave early reduce egress, and a rewatched popular title raises the hit ratio. Both change the estimate.
Exercise
Suppose the platform doubles to 20 million DAU, but each user watches only 30 minutes per day at the same 3 Mbps. The peak factor stays at 3 and the cache hit ratio stays at 95%. What are the peak egress and the peak origin bandwidth?
Show answer
Daily viewing is 20,000,000 × 1,800 s = 3.6 × 10^10 seconds, the same as before. Average egress is therefore still 1.25 Tbps, so peak egress is 3.75 Tbps and peak origin bandwidth is 187.5 Gbps. Egress depends on total watch time and delivered bitrate, not on the number of users alone.
Exercise
A new policy adds a 4K rendition at 15 Mbps and keeps the other three. Uploads stay at 100,000 videos of 10 minutes per day. How much does daily rendition storage grow, and by how much does it grow as a percentage?
Show answer
The extra rendition adds 60,000,000 s × 15 Mbps = 9 × 10^14 bits, which is 112.5 TB per day. Rendition storage rises from 73.5 TB to 186 TB per day, an increase of about 153%. Total daily storage including the 60 TB of sources goes from 133.5 TB to 246 TB.