KatInterview

Build a Petabyte-Scale Blob Storage Service

System DesignModel answer
MediumModel answerSystem Designsystem-designdistributed-storageerasure-coding

Last updated

Design a distributed blob storage service with put, get, delete and list, covering metadata, data placement, multipart uploads and the trade-off between replication and erasure coding.

Task

Design a distributed storage service for unstructured files ("blobs") whose sizes range from a few bytes to several terabytes. Users group blobs into named containers and address each blob by a string key.

Operations to support

  • put(container, key, data): write a blob.
  • get(container, key): read a blob back.
  • delete(container, key): remove a blob.
  • list(container): enumerate the blobs in a container.

Quality goals

  • Durability: stored data must survive hardware failures with very high probability.
  • Availability: the service keeps working when individual machines fail.
  • Scalability: it must hold petabytes of data and sustain heavy request rates.
  • Consistency: eventual consistency is acceptable, but explain what that costs and where you would want stronger guarantees.

What to cover

  1. A high-level architecture that separates the request front end, the metadata layer and the data storage layer.
  2. How keys are partitioned, and how data is mapped to physical storage nodes.
  3. How very large blobs are uploaded (multipart or similar).
  4. How you place data for durability: replication versus erasure coding, and when to use each.

Assumptions you may make

  • A distributed coordination store (etcd or ZooKeeper style) is available.
  • Each storage node has raw block-level disks.

State your own scale numbers (capacity, object count, request rate, durability target) and justify the design against them.

Hints

Hint 1

Estimate the metadata volume (object count times bytes per record) before choosing where to keep it. Does it fit in a coordination store designed for small data?

Hint 2

Separate two mapping problems: the metadata index (which needs ordered scans for prefix listing) and chunk placement (which needs even spread and control of failure domains).

Hint 3

To avoid readers ever seeing a pointer to missing bytes, decide the order of operations on write: which is made durable first, data or metadata? Then think about what cleans up after a crash.

Hint 4

Compare raw-disk overhead of 3x replication against a Reed-Solomon scheme such as 10+4 at hundreds of petabytes, then ask which data can tolerate the higher read and repair cost.