SD-43 · Back to the write-up
Design a File Downloader
The API checks access and signs a URL; the library fetches 8 MB chunks by range from a CDN, checks each against a signed manifest, and keeps a journal so a drop costs one chunk.
Follow a request
Start a download
Download chunks · edge hit
Edge miss
Resume after a drop
Retry a failing chunk
Publish a version
Device
Edge
Services
Data
LibraryIn the app
JournalDone chunks
CDNEdge + shield
Download APISign URLs
TelemetryProgress
Object storageFile versions
Catalog DBManifests
Publish jobChunk + sign
The numbers, at a glance
1 from storage19 from the edge
2.5 Gbit/s100
250 Gbit/s10K
2.5 Tbit/s100K
25 Tbit/s1M
0.4% fetched again2 GB file
A download, in order
Chunks are fetched 4 at a time; only one is shown. Progress reports are sent every minute and never awaited.
Library
Journal
Download API
Catalog DB
CDN
Object storage
1 POST /v1/downloads
2 entitlement, session
3 ok, version 1.4.2
4 201 + signed URL
5 GET manifest
6 signed manifest
7 Range: chunk 0
8 miss: slice
9 8 MB
10 206
11 verified, bit 0 set
12 progress
RequestResponseAsync, does not block
Who carries the bytes
The decision this question is really about.
GET whole file
server reads S3
2 Gbit/s per server
+ Access checked on every byte.− 12,500 servers for 25 Tbit/s.
public link
straight to storage
far users slow
+ No servers in the path.− Anyone, forever; 5 Tbit/s cap.
API: check + sign
Range GET at edgeSHA-256 per chunk
1 cached copy for all
+ Edge checks access; 95% hit rate.− Short lifetimes need renewal.
How it grows
Add a box only when a number forces you to. Highlighted boxes are new at each stage.
App
App server
Object storage
LibraryJournal
Load balancerDownload API
Catalog DBObject storage
LibraryJournal
CDN + shieldDownload API
Catalog DBObject storage
LibraryJournal
2 CDNsDownload APITelemetry
Catalog DBObject storagePublish job
Was this walkthrough useful?Your vote tells us what to improve next.