System DesignSep 18, 2026⏱️ 3 min read
Design S3-Like Object Storage: Placement Groups, Erasure Coding & Compaction

Design S3-Like Object Storage: Placement Groups, Erasure Coding & Compaction

How Cloud Object Storage Achieves 99.999999999% (11 Nines) Durability

Traditional POSIX filesystems struggle beyond tens of millions of files in nested directory trees. Cloud object storage (AWS S3, GCS, Ceph/MinIO) flattens hierarchy into Bucket / ObjectKey -> Immutable Blob, scaling cleanly to exabytes across commodity disks.
S3-Like Object Storage Architecture

S3-Like Object Storage Architecture


1. Separating Data Routing From Metadata

Client ──(HTTP PUT/GET)──► API Gateway (IAM Auth)
                               │
            ┌──────────────────┴──────────────────┐
            ▼                                     ▼
   [Metadata Service (SQL/KV)]          [Data Store + Placement Service]
   (bucket, object_name -> uuid,         (Maps uuid -> Data Node Group,
    version_id, object_mapping)           streams directly to NVMe/HDD pools)
  1. Metadata DB: Stores small records mapping (bucket_id, object_key, version_id) → object_uuid + byte locations. Never caches massive blobs inside SQL.
  2. Data Store Nodes: Append immutable object bytes directly into large pre-allocated 2 GB Data Files (write-once, append-only!) rather than creating millions of tiny OS filesystem inodes.

2. Solving Small File Fragmentation: Read-Only Compaction

If millions of 5 KB thumbnails are written and deleted directly as separate OS files, disk metadata and file-descriptor limits explode. Instead:
  • Incoming objects append sequentially to an active Read-Write Data File (saving exact (file_id, offset, size) in local RocksDB).
  • Once a file hits 2 GB, it seals Read-Only and a fresh active file opens.
  • Background Compaction: Periodically merges sealed files containing deleted objects, copying surviving bytes into fresh compact files and updating object offsets atomically!

3. Replication vs. Erasure Coding (Storage Cost vs. Durability)

Storing 3× full replicas everywhere (like HDFS) wastes 200% extra hardware capacity.
StrategyStorage OverheadFault ToleranceBest For
3-Way Replication3.0× (200% overhead)Survives 2 node lossesHot, small, latency-sensitive chunks
Reed-Solomon Erasure Coding (8+4)1.5× (50% overhead!)Survives any 4 drive/rack failuresS3 Standard / Archive exabyte scale
With Reed-Solomon (k=8, m=4), an object splits into 8 data chunks + 4 parity chunks spread across 12 distinct failure domains (racks/nodes). You lose 3–4 entire servers simultaneously and reconstruct every byte mathematically while cutting storage bills in half vs. 3× replication!

4. Multipart Upload & S3 Versioning

  • Multipart Upload: Files $> 100\text{ MB}$ split into independent parts uploaded in parallel (upload_id + part_number), committed atomically via CompleteMultipartUpload—making retries after flaky network drops trivial.
  • Versioning & Soft Deletes: Deletions simply append a DeleteMarker version row rather than erasing physical blocks immediately, enabling instant undelete and safe async garbage collection.

Share this article

Comments