Dashboard
Courses
Problems
Badges
Theme
Sign inStart free
Courses/Distributed Architecture
Lesson 23 of 24

Erasure coding and durability maths

How storage systems promise eleven nines, the cost of replication versus erasure coding, and why repair speed matters.

22 min read

What eleven nines means

Durability is the probability that an object survives a year. Eleven nines, 99.999999999%, is an annual loss probability of 1e-11 per object. Store 10 million objects and you expect to lose one about every 10 000 years. Availability is different: it is whether you can read the object right now. A system can be extremely durable and still briefly unavailable during a network outage. Object stores typically promise eleven nines of durability but only three or four nines of availability, because losing data is permanent while an outage ends.

Replication versus erasure coding

Three-way replication stores three full copies: 200% overhead, survives any two losses, and reads are simple. Reed-Solomon erasure coding splits an object into k data fragments and computes m parity fragments; any k of the k + m fragments reconstruct it.

  • RS(10, 4): 14 fragments, 40% overhead, survives any 4 losses
  • RS(6, 3): 50% overhead, survives any 3 losses
  • At petabyte scale, 1.4x instead of 3x storage saves more than half the disks
  • Costs: reads of a degraded object need k fragments from k machines, and encoding uses CPU

The maths, roughly

Durability depends on failure rate and repair time. Suppose disks have an annual failure rate of 2% and a lost replica is rebuilt within 6 hours. The chance that a given disk fails in a 6-hour window is about 0.02 x 6 / 8 760, roughly 1.4e-5. For three-way replication to lose data, two more disks holding the same object must fail within the repair window of the first, which gives a loss rate per replica set in the order of 1e-11 per year. Halve the repair time and each extra failure becomes half as likely, so fast, parallel repair is as important as the number of copies.

Correlated failures dominate

The maths assumes independent failures, and reality does not cooperate. Disks from the same batch fail together, a rack loses power, a bad deploy corrupts data on every node, a region floods. Spread fragments across failure domains: no two fragments of an object on the same disk, host or rack, and across at least three availability zones. Protect against logical errors too, with checksums verified on every read and in background scrubbing, versioning, and delayed deletion, because replication faithfully copies a bad write everywhere.

Hot and cold tiers

Many object stores replicate new or hot objects for fast reads and convert them to erasure-coded storage after a few days, when access drops. Small objects are packed into larger extents before coding, because coding a 4 KB object into 14 fragments wastes space and metadata. Metadata, such as the mapping from object key to fragment locations, lives in a separate strongly consistent, replicated service. That metadata is tiny compared with the data, but losing it makes the data unreachable, so it gets the strongest protection of all.

Key takeaways

  • Durability is annual survival probability; availability is readability right now
  • Erasure coding like RS(10,4) gives higher fault tolerance than 3x replication at under half the overhead
  • Durability depends on failure rate and repair time: repair fast and in parallel
  • Correlated failures and logical corruption dominate; spread across failure domains and verify checksums

Sign in to track lessons and earn badges.

Global traffic managementCapstone: putting distributed architecture together

Coming up

Course: 0/24 lessons · 0/10 challenges0%

Build it on the canvas, pass the review (70+) and mark it complete to count it toward the course badge.

  1. 10/10Design an Object Storage ServiceReach eleven nines with erasure coding across failure domains, a consistent metadata service and multipart uploads.MAJORHardPRO
All 10 challenges →