Replication is a proven and valuable mechanism to verify data integrity, but the cost per GB of storage can become high as object sizes and cluster sizes growexpand. A complementary data protection strategy, erasure coding (EC), provides high data durability with a smaller footprint. Swarm manages EC and replication together to optimize cost-effectiveness, converting objects between them seamlessly and dynamically, based on the policies set.
...
Swarm creates multiple sets of erasure segments for very large objects. The object breakdown into one or more erasure sets is transparent to external applications. A GET or HEAD of an erasure-coded object uses the same syntax as a replicated object.
...
Swarm still reads the object as long as there are still k total segments (any combination of original data or parity) remaining in the cluster if a hard drive disk or a node containing an erasure segment fails. Protection against drive disk failure for the object is equal to the number of specified parity p segments.
The segments from a 5:2 (5 data segments with 2 parity segments for a total of 7 segments) or 8:2 (8 data and 2 parity segments for 10 total segments) erasure code are protected against the loss of any two nodes because they are distributed to different nodes. An erasure-coded object is immediately retrievable when accessed even if some segments are missing. Regenerating the missing erasure set segments is performed in a self-healing, cluster-initiated manner (similar to the recovery process for replicated objects) to protect against further drive disk loss. This process kicks off automatically when a missing volume is detected and automatically regenerates any missing segments.
...
One segment per subcluster … up to p segments per subcluster
One segment per node … up to p segments per node
One segment per volume
How much
...
disk space EC saves
The amount of drive disk space (or footprint) used for erasure-coded objects depends on the ratio of data to parity segments in the specified encoding.
Use the following formula to roughly calculate the drive disk space expected to be used by an EC object with one set of erasure segments:
(total segments ÷ data segments ) × object size | = object footprint |
---|---|
((k+p) ÷ k) × GB | = total GB |
How footprint changes with different EC encoding (versus 3 reps)
1 GB object with 5:2 encoding: ((5 + 2) ÷ 5) × 1 GB = 1.4 GB (vs. 3 GB for replication)
3 GB object with 5:2 encoding: ((5 + 2) ÷ 5) × 3 GB = 4.2 GB (vs. 9 GB for replication)
3 GB object with 7:3 encoding: ((7 + 3) ÷ 7) × 3 GB = 4.3 GB (vs. 9 GB for replication)
...