Blog · 2023-04-19 · MooseFS Team

EC4: The Erasure Coding Format We Added in 2020

MooseFS has had the ability to keep archived data in erasure coding instead of full copies since 2017. In October 2020 we added a second erasure coding format, EC4, next to the original EC8. Here’s the trade-off between them, and why you’d pick one over the other.

Instead of duplicating a chunk across Chunkservers, it gets split into data parts and parity parts, and you can lose any one of them and rebuild it from the rest.

More overhead, but fewer servers

Take a chunk, split it into 8 data parts, add one parity part, and it now takes up 112.5% of its original size on disk. Do the same with 4 data parts and one parity part, and you’re at 125% instead. Either way you can lose one part and rebuild it, so the redundancy is identical — EC4 just costs about twice as much overhead to get there. That ratio holds as you add parity: two parity parts run 25% under EC8 and 50% under EC4, three run 37.5% and 75%, and so on up to nine.

What you get for that extra disk space is a much lower bar for cluster size. MooseFS only keeps a chunk erasure-coded while enough Chunkservers exist to hold every part of it. A scheme with N data parts and X parity parts needs N+2X servers before the Master will start converting full copies into parts, and N+X to keep parts that are already converted. With one parity part, EC4 needs 6 servers to start and 5 to hold what’s already there. EC8 needs 10 and 9. A cluster with eight or nine Chunkservers can run EC4 right now and would be stuck waiting for a tenth machine to run EC8 at all.

Which one to use

EC8 wins on space whenever a cluster is big enough to use it, and the bigger the redundancy, the bigger that win. EC4 is for everyone else — six or seven Chunkservers is enough to get archive storage cheaper than full copies, without waiting on a tenth box to show up.

Further reading

The current version of this trade-off, including the full Chunkserver counts for every parity level from one to nine, is in Erasure Coding and Chunkservers needed for an Erasure Coding scheme.