Design Docker Hub from an empty canvas: pushes and pulls of images made of shared, content-addressed layers, through a pull storm when a big cluster scales out.
Unlock it once for 15 credits; everything inside it is free (runs, changes, Submit, results, hints). Sign in with Google to start; new accounts get free credits.
What it must do
Push an image: upload its layers, then its manifest, under a name and tag.
Pull an image: resolve a tag to a manifest, then download the layers the machine does not have.
Store each layer once, by its content hash, however many images share it.
List repositories and tags.
Scale
3,000 requests a second: 2,000 layer downloads, 900 manifest and tag lookups, 100 pushes.
A layer averages 30 MB, so 2,000 downloads a second is about 60 GB/s: far too much for your own servers, which is why layers are served from object storage behind a CDN.
Popular base images are pulled millions of times: the same layers, over and over.
Request types to route: layer (66%, read), manifest (30%, read), push (4%, write). Budget: $10,000 a month.
Estimate first
Layer bandwidth at 2,000 downloads a second of 30 MB (GB/s)
Images pushed a day at 100 a second (million)
Manifest lookups a day (million)
Monthly cloud cost of your design (USD)
The test cases
You start from an empty canvas. When you run the tests, each one simulates your design with its own traffic and failures:
Test
What it does
Passes when
Normal day
The normal day: the traffic in the brief, nothing broken.
Success ≥ 99.9%; p99 latency ≤ 300 ms (manifest); p99 latency ≤ 1.5 s (layer)
A pull storm
At 5 s a big cluster scales out and every new node pulls the same images: traffic quadruples for 8 s.
Success ≥ 99%; p99 latency ≤ 600 ms (manifest)
A server dies
At 4 s one server of the first app service on the request path dies for 10 s.
Success ≥ 99%
Database 5× slower
At 5 s the main database on the request path answers 5× slower for 8 s.
Success ≥ 99%; p99 latency ≤ 600 ms (manifest)
Budget: $10,000/month
The normal day's design must cost at most $10,000 a month.
Cost ≤ $10,000/month
Must include
Layer storage. Layers are immutable blobs named by their hash: object storage keeps one copy and serves it at any scale.
A CDN for layers. The same base layers are pulled again and again; serving them from the edge keeps 60 GB/s off your servers.
Manifest and tag metadata. Tags point to manifests, and manifests list layers: small, hot, consistent metadata.
A registry API. Pushes and tag lookups go through a stateless API that checks names and writes manifests.