Build a Blob Storage Platform with Resumable Large Uploads
System DesignModel answerLast updated
Design a cloud blob store that accepts huge files in parts, keeps them durable across machine and site failures, and scales to petabytes with heavy concurrent traffic.
Design a managed blob storage service, comparable to a public cloud object store, where customers can store and fetch files ranging from a few bytes to several terabytes.
Begin by stating your assumptions: peak request rates, typical and maximum object sizes, total data volume, durability and availability goals, and the consistency you promise. Then cover the areas below.
-
Client-facing API
- Sketch REST endpoints to write, read, inspect, delete and list objects, where an object is identified by a container (bucket) plus a key.
- Explain how requests are authenticated and how per-object metadata (size, content type, custom attributes) is handled.
-
Large-file uploads
- Describe how a multi-gigabyte file is broken into parts and sent.
- Explain how progress is tracked, how a failed part is retried, and how the parts become one final object.
- Discuss the effect of part size and how integrity is verified (checksums).
-
Storage layout and replication
- Separate the design of the data layer from the metadata layer, and say what each stores.
- Explain how data survives disk, machine and whole-site failures (replication versus erasure coding).
- State your consistency model for reading data just after writing it.
-
Failure handling and disaster recovery
- What happens when an entire data center is lost? How are failures detected, how is traffic redirected, and how do reads and writes continue?
- How do backups and restores work, and how do you keep data loss at or near zero in a catastrophe?
-
Scale and performance
- How do you support very high request rates and petabyte-scale storage?
- Cover partitioning/sharding, load balancing and caching.
Finish by walking through one complete upload and one complete download from the client's perspective down to the disks.
Hints
Hint 1
Keep data and metadata apart: the bytes are large and never change once written, while the metadata is small and needs transactional updates. Make the metadata commit the single point at which an object becomes visible.
Hint 2
For multipart uploads, make each part idempotent by part number, let the client list already-stored parts to resume, and have the 'complete' step stitch together references to existing chunks instead of copying bytes.
Hint 3
Compare 3x replication with erasure coding such as 8 data + 4 parity fragments spread over three zones. Compute the storage overhead and check that losing one zone still leaves enough fragments to rebuild data.
Hint 4
Remember background machinery: repair of lost fragments, a scrubber that detects bit rot, garbage collection of orphaned data from failed uploads, and cross-region replication for region-level disasters.
Model answer
Medium Try it yourself first — then compare your approach, complexity and edge cases.
Assumptions
- Capacity: about 100 PB, roughly 10^11 objects. Median object about 100 KB, mean about 1 MB, maximum 5 TB.
- Peak traffic: about 1M reads/s and 200K writes/s. Aggregate egress is on the order of 1 TB/s, so bandwidth rather than CPU is the main cost.
- Goals: 11 nines durability, 99.99% availability, strong read-after-write consistency per key, and survival of the loss of one availability zone (AZ) with no data loss and no loss of write availability.
API
Objects are addressed by bucket + key. The key namespace is flat; / is merely a convention that listing can use via a delimiter.
| Operation | Request |
|---|---|
| Write | PUT /buckets/{b}/objects/{key} with Content-Length, Content-Type, a checksum header, and x-meta-* custom attributes |
| Read | GET /buckets/{b}/objects/{key}, optional Range and versionId |
| Inspect | HEAD on the same path |
| Delete | DELETE on the same path |
| List | GET /buckets/{b}/objects?prefix=&delimiter=&continuationToken=&maxKeys= |
Authentication uses signed requests (access key ID, canonical request, timestamp, HMAC) plus presigned URLs for time-limited delegated access. Policies are evaluated by an IAM component whose results are cached at the front end. Responses return an ETag, size, content type, last-modified time and version ID.
Architecture
Client, then DNS/anycast, then load balancers, then a stateless front-end fleet. Behind it sit a metadata service (sharded, consensus-replicated), a placement service (picks healthy nodes), and storage nodes that append data into large extents of about 1 GB. Background workers handle repair, scrubbing, GC, lifecycle tiering and cross-region replication.
The central decision is splitting data (huge, immutable, streamed) from metadata (small, transactional). Small objects are packed into shared extents to avoid per-file filesystem overhead. Because objects are immutable, an overwrite writes new data and then atomically moves a pointer.
Metadata model
- Buckets: owner, policy, versioning flag.
- Object index keyed by
(bucket, key, version desc): size, content type, ETag, checksum, user metadata, a list of chunk references(extentId, offset, length), and state. - Multipart uploads keyed by
(bucket, key, uploadId)with a part table. - Extent map: erasure scheme and fragment locations.
Shard the index by hash of (bucket, key) or by key range. Hash spreads hot buckets evenly; ranges make listing cheap. A common compromise is range partitioning with automatic splitting of hot ranges. Each shard is a Raft group of 5 replicas distributed 2/2/1 across AZs, so an AZ loss still leaves a quorum.
Upload flow
- The front end authenticates and checks policy.
- The placement service returns a set of nodes spread across AZs.
- The front end streams the body, erasure-codes it, and writes fragments to nodes in parallel without buffering the whole object.
- It compares the client checksum with the computed one and rejects mismatches with a 400.
- Once enough fragments are durable, it commits the index row via the shard leader. This commit is the visibility point.
- It returns 200 with the ETag.
A crash before step 5 leaves only orphan fragments that GC removes; readers never observe a partial object.
Download flow
- Authenticate and fetch metadata from the shard leader (or a version-validated cache).
- Read any k fragments in parallel, preferring same-AZ and fastest nodes, with hedged requests to cut tail latency.
- Verify checksums, decode if parity was needed, and stream. Range requests touch only the chunks that overlap.
Multipart upload
- The client splits the file and sends parts in parallel; typical part limits are 5 MB to 5 GB and at most 10,000 parts.
initiatereturns anuploadId; eachuploadPart(uploadId, n)stores the part as normal chunks with a per-part checksum and returns its ETag.- Parts are idempotent by number: re-sending part n overwrites it. After a crash the client calls
ListPartsand uploads only what is missing. completereceives the list of(partNumber, etag), validates it, and writes one index row whose chunk list concatenates the parts' chunk references. No bytes are copied, so completion costs only metadata work. The final ETag can be a hash of the part hashes plus a part count.abortand a lifecycle rule that expires stale uploads let GC reclaim orphaned parts.
Part-size trade-off: small parts (5-8 MB) make retries cheap and parallelism fine-grained but add request and metadata overhead; huge parts reduce overhead but make a failure expensive. A default of 16-64 MB works, scaled up so the file fits in 10,000 parts (a 5 TB file needs parts of at least about 500 MB).
Durability and replication
- Erasure coding RS(8,4): 8 data + 4 parity fragments is 1.5x overhead versus 3x for triple replication. Place 4 fragments in each of 3 AZs, at most one per node/rack. Losing an AZ removes 4 fragments and the remaining 8 still reconstruct the object.
- Small or hot objects: 3-way replication across AZs for latency, later compacted into EC extents.
- Why 11 nines is plausible: independent failure domains, fast parallel repair (a failed disk is rebuilt from thousands of peers within minutes), prioritising stripes with the fewest surviving fragments, continuous scrubbing against bit rot, and end-to-end checksums.
Consistency
Write data first, then commit metadata through consensus. Reads go through the shard leader (or a validated cache), which gives strong read-after-write, overwrite and list consistency within a region. Cross-region replication is asynchronous and therefore eventually consistent.
Failure handling and disaster recovery
- Detection: health checks and heartbeats feed the load balancers and DNS/anycast; unhealthy AZs are drained automatically.
- AZ loss: metadata keeps quorum (3 of 5), reads decode from the remaining fragments, and new writes are placed in the surviving AZs, possibly with a temporary wider stripe. Repair rebuilds the missing fragments when capacity returns.
- Region loss: asynchronous cross-region replication of objects and metadata, with an RPO of seconds to minutes; opt-in synchronous or tightly bounded replication for critical buckets. Traffic fails over by DNS.
- Accidental deletion and corruption: versioning, soft delete with a retention window, and object lock; metadata snapshots plus a log allow point-in-time restore.
Scale and performance
- Stateless front ends scale horizontally behind L4/L7 balancers; clients are spread with DNS and anycast.
- Metadata shards split automatically when hot; prefix-heavy workloads are mitigated by hashing or randomizing key prefixes.
- Caching: edge CDN for popular objects, an in-memory metadata cache validated by version, and SSD tiers for hot extents.
- Throughput comes from parallel fragment I/O and large sequential appends. Tier cold data to cheaper media via lifecycle policies.
Common mistakes
- Putting metadata and data in one store, which prevents independent scaling.
- Making the data write the commit point instead of the metadata write, exposing partial objects.
- Ignoring orphan cleanup and stale multipart uploads.
- Assuming replication alone gives 11 nines without repair, scrubbing and checksums.
- Choosing part sizes without respecting the part-count limit.
- Buffering whole objects in front ends.