← Back to Database and Storage

Erasure Coding

Erasure coding for durable storage with parity fragments and repair trade-offs.

Database and StorageData RedundancyData Storage

Erasure coding is a durability technique used in large-scale storage systems to protect data with less raw storage overhead than full replication. Instead of keeping several complete copies of an object, the system divides the object into data fragments and computes extra parity fragments. If enough fragments survive, the missing ones can be reconstructed mathematically.

A common notation is k plus m. The object is split into k data chunks and m parity chunks. For example, a 4 plus 2 scheme stores six chunks total. Any four of them are sufficient to recover the original object. That means the system can survive the loss of any two chunks without losing data.

The obvious advantage is efficiency. Three-way replication stores three complete copies, which means 200 percent overhead relative to the original data. A 4 plus 2 erasure-coded layout stores six chunks for four chunks of useful data, which is 50 percent overhead. At large scale, that difference is enormous for storage cost.

The tradeoff is computational and operational complexity. Replication is simple: write full copies and read one back. Erasure coding requires encoding work on write and reconstruction work on some reads or repairs. When a disk or node fails, recovery may need to read several surviving fragments across the network to rebuild the missing one. That creates repair traffic and CPU load that replication often avoids.

Placement strategy matters as much as the math. Chunks and parity should be spread across failure domains such as disks, hosts, racks, or availability zones so that one local failure does not wipe out too many fragments at once. Poor placement can make a theoretically durable scheme fragile in practice.

Erasure coding therefore fits best for large objects, colder data, and systems that optimise strongly for storage efficiency and long-term durability. Object stores are a natural fit because reads are often whole-object or large-range operations, and the platform can absorb the extra repair complexity centrally.

It is less attractive for very hot, latency-sensitive small writes. Small updates can be expensive because changing one piece of data may require recomputing parity. Many systems therefore combine techniques: replication for recent or hot data, then erasure coding later once the object becomes colder and less frequently modified.

Another important detail is that durability claims depend on more than fragment count. Repair speed, bit-rot detection, scrubbing, correlated failure domains, and operational discipline all matter. A mathematically elegant code cannot help if failed fragments remain unrepaired for too long or if several chunks were accidentally placed too close together.

In short, erasure coding trades simpler storage behaviour for better space efficiency at a given durability target. It is powerful because storage systems care deeply about the cost of redundancy. The technique earns its place when the platform can manage the extra encoding, placement, and repair complexity well enough that users experience the result simply as highly durable storage.