Alex Xu Profile picture
Co-Founder of ByteByteGo | Author of the bestselling book series: โ€˜System Design Interviewโ€™ | YouTube: https://t.co/9gPSJSrtPU

Feb 18, 2022, 7 tweets

A really cool technique thatโ€™s commonly used in object storage such as S3 to improve durability is called ๐„๐ซ๐š๐ฌ๐ฎ๐ซ๐ž ๐‚๐จ๐๐ข๐ง๐ . Letโ€™s take a look at how it works. 1/7

Erasure coding deals with data durability differently from replication. It chunks data into smaller pieces and creates parities for redundancy. In the event of failures, we can use chunk data and parities to reconstruct the data. 4 + 2 erasure coding is shown in Figure 1. 2/7

1๏ธโƒฃ Data is broken up into four even-sized data chunks d1, d2, d3, and d4.

2๏ธโƒฃ The mathematical formula is used to calculate the parities p1 and p2. To give a much simplified example, p1 = d1 + 2*d2 - d3 + 4*d4 and p2 = -d1 + 5*d2 + d3 - 3*d4. 3/7

3๏ธโƒฃ Data d3 and d4 are lost due to node crashes.

4๏ธโƒฃ The mathematical formula is used to reconstruct lost data d3 and d4, using the known values of d1, d2, p1, and p2. 4/7

How much extra space does erasure coding need? For every two chunks of data, we need one parity block, so the storage overhead is 50% (Figure 2). While in 3-copy replication, the storage overhead is 200% (Figure 2).
5/7

Does erasure coding increase data durability? Letโ€™s assume a node has a 0.81% annual failure rate. According to the calculation done by Backblaze, erasure coding can achieve 11 nines durability vs 3-copy replication can achieve 6 nines durability. 6/7

What other techniques do you think are important to improve the scalability and durability of an object store such as S3? 7/7

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling