CDN vs Origin Server
Two layers, two jobs.
Origin is the authoritative source of your content — typically object storage (S3, R2, GCS) or a server farm. The full library lives here. Read costs are higher; geographic distance to viewers is whatever it is.
CDN (Content Delivery Network) is a distributed network of edge servers that cache content close to viewers. Cloudflare, Fastly, Akamai, AWS CloudFront — all are CDNs. Each has hundreds of points-of-presence (POPs) globally. When a viewer requests content, the nearest POP serves it from cache.
How a video request flows
- Viewer’s browser requests
/segment-001.m4sfrom CDN. - CDN edge checks its cache for that URL.
- Cache hit → serve from edge. Sub-100ms typical.
- Cache miss → edge fetches from origin (R2 in AVCaption’s case), stores in cache, serves to viewer.
- Subsequent viewers in same region get cache hits.
For HLS video, segments are immutable (URL-keyed by content hash) so cache hit rates are >95% for any video with multiple viewers.
Why this matters for video
- Speed: Edge is 10-100ms RTT to most viewers. Origin would be 50-300ms.
- Cost: CDN bandwidth is cheaper than origin egress (especially with R2 → CF CDN egress being free).
- Scale: One viral video can serve millions of viewers without origin load.
- Reliability: Edge nodes around an outage region serve cached content even if origin is down.
On AVCaption
Origin = Cloudflare R2 (object storage, S3-compatible, zero egress to CF CDN). Delivery = Cloudflare CDN (300+ POPs).
This pairing means:
- Storage is durable and geographically replicated by R2.
- Delivery is fast and aggressively cached at edge.
- Egress between R2 and CF CDN is free, which is why AVCaption can offer flat-tier pricing without per-GB delivery fees.