Video Edge Storage (Byte-Range Caching)

You can't fit a 50GB movie into a local edge node's RAM.

The idea

Normally, a CDN fetches a whole file from the origin and caches it. But streaming 4K video is different. A single movie might be 50GB. If a user in Tokyo watches 5 minutes of a movie and closes the app, the Tokyo Edge Node shouldn't fetch and cache the remaining 49.5GB! Instead, video CDNs use Byte-Range Caching, pulling and caching the video in small chunks (e.g. 2MB segments) exactly as the user watches them.

Step 1: User requests the first chunk of a movie (Bytes 0 - 2MB).

How it works (HTTP Range Requests)

Video players don't ask for "movie.mp4". They use the HTTP Range header to ask for specific bytes. The CDN's edge node translates this into caching individual chunks rather than whole files.

# Inside the Video CDN Edge Node

def serve_video(request):
    # The player asks for a chunk: "Range: bytes=2000000-4000000"
    byte_range = request.headers['Range']
    cache_key = f"/movie.mp4__{byte_range}"
    
    if cache.has(cache_key):
        return cache.get(cache_key)
        
    # On cache miss, fetch ONLY that 2MB chunk from the Origin
    chunk = origin.fetch(
        "/movie.mp4", 
        headers={'Range': byte_range}
    )
    
    cache.put(cache_key, chunk)
    return chunk

Cost

By breaking large files into chunks, you drastically save bandwidth and disk space on the CDN edge nodes. The trade-off is an increase in total requests to the Origin (thousands of small chunk requests instead of one large file request), which requires the Origin to support efficient random-access disk reads.

Watch out for