Skip to content

Design an Object Store Like S3

A system design interview walkthrough for an object store like S3, covering erasure coding, metadata partitioning, commits, listing, repair and hot prefixes.

Advanced24 minUpdated 2 December 2026

Before this: Distributed File Systems (DFS), Data Partitioning (Sharding)

"Design an object store like S3" asks for the system that holds the files of everyone else's system: images, backups, logs, model weights, anything addressed by a bucket and a key. Users see PUT, GET, DELETE and LIST. Underneath is a few thousand disks that must lose none of your data.

The distributed file systems lesson covers the building blocks, namely chunking, a metadata service and the trade between replication and erasure coding, and shows object storage as the version you will use. This page is about designing one: what happens on a PUT so a crash cannot leave half an object, how the namespace is partitioned so LIST by prefix still works, how 14 shards of an object are placed so a rack failure is survivable, and what keeps all of it correct while disks die every day.

The interviewer is listening for durability reasoning, not product knowledge. "Eleven nines" is a claim, and a good answer shows the mechanism behind it.

Clarify the requirements

Functional requirements:

  1. PUT an object (bytes of 1 byte to 5 TB, plus metadata) to a bucket and key, GET it (or a byte range) and DELETE it.
  2. LIST the keys in a bucket by prefix, in lexicographic order, with pagination.
  3. Large objects upload in parallel parts (multipart upload).
  4. Optional versioning: keep prior versions of a key.
  5. A GET after a successful PUT of the same key returns the new object.

Out of scope, said aloud: access policies and IAM details, event notifications, cross-region replication, storage classes beyond mentioning them.

Non-functional requirements:

  • Extreme durability: objects must survive disk, server and rack failures, and silent corruption. The target is losing less than one object in a hundred billion per year.
  • High availability, with reads served during failures and repairs.
  • Strong consistency for single-key operations: read-after-write and consistent listing.
  • Scalable: billions of objects, petabytes, growing continuously.
  • Cheap per byte: this is the point of an object store, so overhead matters.

Estimate the scale

Assume a private-cloud scale of 10 billion objects averaging 1 MB (10 PB logical), 20,000 requests per second on average, 98% reads, and a 3× peak.

Request mix: 19,600 GETs and 400 PUTs per second on average, and about 60,000 requests per second at peak.

Ingest and growth: 400 PUT/s × 1 MB = 400 MB/s = 34.6 TB a day. At that rate 10 PB is about nine months of data.

Read bandwidth: 19,600 × 1 MB ≈ 20 GB/s (about 160 Gbps) on average, and 60 GB/s at peak.

Raw capacity with replication: 10 PB × 3 = 30 PB.

Raw capacity with erasure coding (10 data + 4 parity shards): 10 PB × 14/10 = 14 PB, saving 16 PB.

Drives and servers: with 20 TB drives filled to 80% (16 TB usable): 14 PB ÷ 16 TB ≈ 875 drives, about 37 servers of 24 drives. Round up to 40 so a shard can sit in 14 distinct servers across racks, with spare capacity.

Metadata: 10 billion objects × 300 bytes = 3 TB. It is small enough to keep on SSD and partition into ranges of about 100 GB, so around 30 ranges at the start.

Metadata operations: every request touches the index once, so up to 60,000 index operations per second at peak, 400 of them writes on average.

"The bytes are the cost: 14 PB with erasure coding versus 30 PB with replication, a 16 PB difference that pays for the complexity. The metadata is the bottleneck risk: 3 TB is small, but every request touches it, and listing needs it in sorted order. Durability will come from where the 14 shards live and how fast lost ones are rebuilt."

You can reproduce the request rates in the capacity estimator: treat 1 million clients, with reads and writes per day that match 19,600 GETs and 400 PUTs per second.

API and data model

PUT    /{bucket}/{key}                 body                 -> 200 ETag
GET    /{bucket}/{key}                 Range: bytes=0-1048575
DELETE /{bucket}/{key}
GET    /{bucket}?prefix=logs/2026/&delimiter=/&max-keys=1000&continuation-token=...
POST   /{bucket}/{key}?uploads        then PUT ?partNumber=n, then POST ?uploadId=... (complete)
metadata   (bucket, key, version) -> { size, etag, checksum, created_at, shard_map, deleted? }
shard_map  [ (shard 0..13) -> (server, drive, shard_id) ]     14 entries for 10+4
shard      checksummed blob on a drive, addressed by shard_id

The key is a flat string. "Folders" are a convention: logs/2026/12/ is a prefix, and the delimiter parameter lets the listing group keys by it. There is no directory tree to keep consistent, which is a large part of why the system scales.

High-level design

The slice to simulate is the request path: a gateway, a stateless front end, the metadata index and the data tier.

A gateway and front end authenticate requests, look up each object in a metadata index and read or write its data in the storage tier.clientsgatewayfront endmetadata indexdata tier
A gateway and front end authenticate requests, look up each object in a metadata index and read or write its data in the storage tier.
  • Clients reach a front end through an API gateway that authenticates and throttles.
  • The front end looks up or updates the object's record in the metadata index.
  • It reads or writes the object's bytes in the data tier, which spreads keys across prefixes.
Describe this diagram

Components

  • clients (Client)
  • gateway (API gateway)
  • front end (Service)
  • metadata index (DynamoDB)
  • data tier (Object storage (S3))

Connections

  • clients sends to gateway
  • gateway sends to front end
  • front end sends to metadata index
  • front end sends to data tier

Run it, then try reducing the data tier's prefixes to 1 or raising the load, and watch the throttling. A single hot key range limits throughput however many servers sit behind it, which is the prefix lesson in the second decision below.

The write path: the front end splits the object into 10 data shards, computes 4 parity shards, and writes the 14 shards in parallel to 14 servers in distinct failure domains. Only when at least enough shards are durable (all 14 in the simplest rule) does it commit the metadata record, in a single atomic write. The commit is the moment the object exists.

The read path: the front end reads the metadata record, then fetches the 10 data shards in parallel and concatenates them. If a shard is missing or slow, it fetches a parity shard and reconstructs.

The interesting problem: storing the bytes

Approach A: three full replicas

Write the whole object to three servers in different racks.

Good: simple. A read goes to one server and needs no computation, and recovery is a plain copy.

Bad: 200% overhead, which is the 30 PB number. It tolerates two losses, so a stripe of replicas that loses three servers in a rack-and-disk event is gone.

Approach B: erasure coding across failure domains

Split each object into 10 data shards, compute 4 parity shards, and place each of the 14 on a different server, spread across racks and zones. Any 10 shards rebuild the object.

Good: 1.4× overhead instead of 3×, and it tolerates any 4 simultaneous shard losses, better than replication's two. Placing shards in separate failure domains means a rack outage costs at most a few shards of any object.

Bad: every PUT writes 14 shards and computes parity. A degraded GET must read 10 shards and decode. Repair is read-heavy: rebuilding one lost shard reads 10 others, ten times the repair traffic of replication. A GET finishes only when its slowest required shard arrives, so tail latency worsens.

Mitigate the tail: send reads to 11 or 12 shards and use the first 10 that answer (a hedged read), which trims the slowest responders.

Approach C: choose by object size

Erasure coding a 4 KB object into 14 shards of 400 bytes is mostly overhead: 14 disk operations, 14 metadata entries and wasted block space. Pack small objects (under about 1 MB) together into large append-only container files, replicate the containers three times, and keep a pointer (container, offset, length) in the metadata. Erasure code only the large objects and the cold, sealed containers.

Good: small-object workloads (thumbnails, config files) stay efficient, and large objects get the cheap 1.4×.

Bad: two storage paths, plus compaction to reclaim space in containers when small objects are deleted.

The recommended answer is B for the bulk and C for small objects. A single sentence captures it: "Erasure code what is large and cold for cost, replicate or pack what is small and hot for efficiency." Then address the 10 PB of mostly 1 MB objects: at that size B is right.

The second decision: the namespace and the commit

The bytes are only half the system. The index decides whether LIST works, whether reads are consistent and how the system survives a hot prefix.

Range-partition the index, not hash-partition. LIST returns keys in lexicographic order for a prefix, so keys that sort together must live together. Hash partitioning scatters a prefix over every partition and turns a listing into a scan of the whole cluster. Range partitioning keeps a prefix on one or a few partitions, and a listing is a sequential read. The cost is that load follows the key distribution, which is the next paragraph.

Hot prefixes. If clients write keys that increase (2026-12-02T10:00:01.jpg, then ...:02.jpg), all new writes land in the last range, and one partition takes the whole write load. A range can serve only a bounded rate (as a guide, a published S3 limit is 3,500 writes and 5,500 reads per second per prefix). Defenses: split a range automatically when its load is high, throttle with 503 SlowDown and a retry hint, and advise clients to add a short hash to the front of keys so writes spread over many ranges.

The commit point and consistency. Because the metadata record is written atomically and only after the shards are durable, a GET either finds the old record (and the old shards) or the new one, never a half-written object. Reading the index from its leader or with a consistent read gives read-after-write consistency for new keys, overwrites, deletes and listings. A failed PUT leaves orphan shards with no metadata pointing at them, which a garbage collector removes by comparing shards against metadata, with a grace period so it never deletes the shards of a write still in flight.

Versioning and delete. With versioning, a PUT creates a new version record and a DELETE adds a delete marker, so nothing is lost. Without it, deleting removes the metadata record first, and the garbage collector frees the shards later, which makes delete fast and crash-safe.

Bottlenecks and failures

A disk dies. At about 2% annual failure rate, 875 drives lose roughly 18 a year, one every few weeks. The system notices missing shards, and a repair service rebuilds them elsewhere in parallel from the surviving shards. Durability is mostly how fast you re-create lost redundancy before more failures pile up.

Silent corruption. Disks return wrong bytes without an error. Every shard carries a checksum verified on read, and a background scrubber reads every shard on a schedule (for example monthly) to find rot early, then repairs from the others.

A rack or zone fails. Because no rack holds more than a few shards of any object, reads keep working using parity, and repair starts at once. Writes go to healthy racks.

Slow or overloaded servers. One slow server delays every request that uses a shard on it. Hedged reads, per-server queue limits and routing around slow nodes keep the tail in check.

Large uploads. A 5 TB object cannot be sent in one request. Multipart upload sends parts in parallel, each part stored and checksummed independently, and a final complete call with the part list commits one metadata record. Incomplete uploads expire after a window and are garbage collected.

Listing under load. A LIST of a prefix with 100 million keys must paginate with a continuation token (the last key returned), reading ranges in order, rather than counting or sorting a huge result.

Trade-offs to name aloud

  • Erasure coding over replication: 1.4× instead of 3× storage, in exchange for heavier writes, repairs and tail latency.
  • Range partitioning: efficient prefix listing, in exchange for exposure to hot ranges.
  • Commit by metadata: atomic visibility and simple consistency, in exchange for orphan shards and a garbage collector.
  • Packing small objects: efficient small writes, in exchange for compaction.
  • Strong consistency: a consistent index read per request, in exchange for index capacity and latency.

What interviewers listen for

  • A working answer: a flat namespace, a metadata service, storage nodes, replication and a PUT/GET/LIST API.
  • A strong answer: quantifies replication versus erasure coding, places shards across failure domains, describes the commit and range-partitioned listing.
  • A standout answer: also explains hedged reads, repair bandwidth and why durability depends on repair time, scrubbing for silent corruption, orphan garbage collection, small-object packing and hot-prefix splitting.

Check your understanding

Common mistakes

Saying "eleven nines" without a mechanism. Durability comes from redundancy, failure-domain placement, fast repair and scrubbing. Name each.

Putting metadata and data in one system. The index needs ordering and low-latency lookups, the data needs cheap capacity. They scale differently.

Hash-partitioning the namespace. It balances load beautifully and breaks LIST. Explain the order requirement first.

Ignoring small objects. Erasure coding a 4 KB file is wasteful. Mention packing, or you will be asked.

Forgetting what a failed PUT leaves behind. Orphan shards cost money and confuse repair. The garbage collector belongs in the design.

No story for the slow shard. A GET that waits on the slowest of 10 servers has terrible tail latency. Hedged reads are the standard answer.

Practice

A 20 TB drive (16 TB used) fails. How long does repair take, and why does that matter for durability?

Write your own answer first, on paper or in a note. Then compare.

Show a hint

Rebuilding one shard reads ten others. Count the bytes read, and divide by the repair bandwidth the whole cluster can spare.

Show a strong answer

Count the repair reads. The failed drive held 16 TB of shards. Rebuilding each one reads 10 other shards, so repair reads 10 × 16 TB = 160 TB.

Count the repair bandwidth. The other 874 drives each give about 50 MB/s to repair (a quarter of a 200 MB/s drive), for about 43.7 GB/s in total, since the lost shards' peers are spread across the whole cluster.

Divide. 160 TB ÷ 43.7 GB/s ≈ 3,660 seconds, about an hour. Repair is fast because it is spread over every drive, not funneled into one replacement disk.

Why it matters. Data is at risk only while fewer than 14 shards exist. With 4 parity shards, loss needs five failures inside one object's repair window. A shorter window makes that far less likely, so durability improves when repair speeds up, and it worsens if repair is throttled so far that windows stretch to days.

The pattern worth keeping: durability is a race between failure and repair, so design for fast, distributed repair.

A customer writes keys named with timestamps and gets 503 SlowDown errors despite plenty of servers. What is happening, and what do you do?

Write your own answer first, on paper or in a note. Then compare.

Show a hint

Think about which index range receives every new write.

Show a strong answer

Diagnose it. Increasing keys sort last, so every new write goes to the final range of the index. Servers elsewhere sit idle, and one range cannot exceed its per-prefix rate (about 3,500 writes per second as a guide), so the system throttles with 503.

Split by load. The index should split a range when its request rate stays high, dividing the key space so two partitions share the load. Splitting works for random keys, but a purely increasing key keeps hitting the newest range, so it only helps so much.

Fix the keys. Add a short hash prefix (two hex characters give 256 prefixes) so writes spread across 256 ranges, accepting that listing in time order now needs one listing per prefix, merged by the client. Or store the timestamp later in the key and begin with a high-cardinality field such as the device id.

Return a useful error. Send 503 SlowDown with a retry hint, and have clients retry with exponential backoff and jitter.

The pattern worth keeping: in a range-partitioned system, sequential keys are the enemy, so spread them or split ranges.

Key takeaways

  • Erasure coding (10+4) stores 1.4× instead of 3× and tolerates four losses, at the cost of heavier writes and repair.
  • Place shards across failure domains, so correlated failures cost few shards.
  • Durability is a repair race: fast, distributed rebuild and scrubbing matter as much as redundancy.
  • The metadata commit is the visibility point, and a garbage collector removes orphans.
  • Range-partition the index so listing works, and guard against hot ranges.
  • Pack small objects, and erasure code the large ones.

Further reading

  • S. Ghemawat, H. Gobioff and S. Leung, "The Google File System", SOSP (2003).
  • C. Huang et al., "Erasure Coding in Windows Azure Storage", USENIX ATC (2012).
  • S. Muralidhar et al., "f4: Facebook's Warm BLOB Storage System", OSDI (2014).
  • D. Beaver et al., "Finding a Needle in Haystack: Facebook's Photo Storage", OSDI (2010): packing small objects.
  • Amazon Web Services, Amazon S3 User Guide, "Best practices design patterns: optimizing Amazon S3 performance".

Check yourself

3 questions in this lesson. Answer each once to complete it.

Practice this

Lessons in this track