System design · 7 of 16
Mid
Senior
- Monitoring and alerting for 100 servicesSRE · Platform · DevOps
- Secrets management platformDevOps · Platform · SRE
- Multi-region active-active serviceSRE · Platform
- Distributed job scheduler (cron at scale)SRE · Platform
- Internal developer platform (IDP)Platform
- Multi-tenant Kubernetes platformPlatform · DevOps · SRE
- GitOps for a fleet of 100 clustersPlatform · DevOps
- ML training platform and feature storeMLOps · Platform
- LLM inference platformMLOps · Platform · SRE
MID · 11 MIN · DEVOPS · PLATFORM
Container and artifact registry
Content-addressed blobs in object storage, a metadata database, pull-through caches, CVE rescans and replication to other regions.
- Peak load
- ~1 GB/s pulls in a scale-up
- Availability target
- 99.95%
- RTO: back up within
- 30 min
- RPO: data you can lose
- 15 min
← Swipe sideways to see the whole diagram →
The question
"Design an internal registry for Docker images and packages (Maven, npm, PyPI) used by every CI pipeline and every Kubernetes node."
Requirements
- Push and pull OCI images and common package formats.
- Pulls must be fast and highly available: if the registry is down, nothing can deploy or scale.
- Cache public registries (Docker Hub has rate limits) and block known-bad packages.
- Keep costs down with cleanup rules.
How it works
- CI pushes images; nodes pull them through a load balancer to stateless registry API servers.
- Image layers are stored in object storage by their SHA-256 digest (content-addressed), so identical layers are stored once.
- A metadata database (Postgres) holds repositories, tags, permissions and quotas.
- For public images and packages, the registry acts as a pull-through cache: first pull fetches from upstream, later pulls are local.
- A scanner checks new images and rescans old ones when new CVEs appear.
- Blobs replicate to another region, and each region serves its own nodes.
Remember it: tags move, digests don't. Deploy by digest (
image@sha256:...) for repeatable releases.
Key decisions
| Decision | Choice | Why |
|---|---|---|
| Storage | S3 / GCS behind the API | durable, cheap, scales without disks |
| Product | Harbor, Artifactory, ECR | build vs buy: buying is usually right |
| Cleanup | keep last N tags, delete untagged after 7 days | storage grows fast otherwise |
| Rollout | node-local caches / image pre-pulling | faster scale-ups and fewer registry calls |
What breaks and how it heals
- Registry down: already-running pods keep running; new pods fail with ImagePullBackOff. Run several replicas across zones and a replica region.
- Upstream outage (Docker Hub down): cached images keep working.
- Huge images slow scale-ups: smaller base images, lazy-loading image formats, pre-pulling on new nodes.
Load and capacity
| Item | Assumption | Result |
|---|---|---|
| Fleet | 5,000 nodes | steady pulls are small; spikes come from scale-ups |
| Big scale-up | 200 new nodes each pull a 500 MB image in 2 minutes | 100 GB in 2 min ≈ ~0.8 GB/s from storage |
| Storage | 50 TB today, +2 TB per month | cleanup rules typically remove 40-60% |
| Pushes | 3,000 pipelines a day | ~2 per minute on average |
High availability and disaster recovery
| Target | Number | How it is met |
|---|---|---|
| Availability | 99.95% (every deploy and scale-up needs it) | 3+ API replicas across AZs, Postgres Multi-AZ, blobs in S3 |
| A zone fails | no impact | replicas in the other zones keep serving |
| Region fails | RTO 30 min, RPO 15 min | blobs copied to a second region (cross-region replication, minutes behind) plus a database replica |
| Upstream registry outage | no impact for cached images | pull-through cache keeps every image used before |
What interviewers listen for
- Content addressing and why it saves storage and makes deploys reproducible.
- Availability thinking: the registry is on the critical path for every deploy.
- Caching upstream, scanning and retention policies.