+ All Categories
Home > Documents > Novel Codes for Cloud Storage€¦ · n blocks (n,k) = (4,2) A1 A2 A3 A4 X1 X2 X1 X1 X2 X2 + + 2...

Novel Codes for Cloud Storage€¦ · n blocks (n,k) = (4,2) A1 A2 A3 A4 X1 X2 X1 X1 X2 X2 + + 2...

Date post: 04-Nov-2020
Category:
Upload: others
View: 4 times
Download: 0 times
Share this document with a friend
1
Novel Codes for Cloud Storage Maheswaran Sathiamoorthy*, Megasthenis Asteris*,        Dimitris Papailiopoulos*, Alexandros G. Dimakis*,  Ramkumar Vadali**, Scott Chen**, Dhruba Borthakur** * - USC, ** - Facebook [email protected] *-code opensourced at http://github.com/madiator/hadoop-20 Cloud Storage Erasure Coding Replication Coded Storage Xorbas Experiments and Results Facebook clusters Thousands of machines in data centers Failure is the norm rather than the exception To provide reliability, replication is used. each file is stored multiple times (generally thrice). replication costly, so could coding be an alternative? Hadoop: Distributed storage system, widely used. A X1 X2 A1 A2 A3 A4 Split into k blocks Code into n blocks (n,k) = (4,2) A1 A2 A3 A4 X1 X2 X1 X1 X2 X2 + + 2 Example Code = = = = (n,k) coding: Split file in k blocks and then code into n blocks Any k of the n blocks enough to recover the file e.g.: Reed Solomon codes failure Node 1 X1 Node 2 X2 Node 3 X1 Node 4 X2 Node 5 X1 Node 6 X2 New Node X1 Can tolerate 2 failures Storage overhead: 200% Repair overhead: 0% failure New Node Node 1 A1 Node 2 A2 Node 3 A3 Node 4 A4 Can tolerate 2 failures Storage overhead: 100% Repair overhead: 100% A1 3x Replication (4,2) Coding The Repair Problem: (n,k) code requires k blocks to be read for repairing one block Lower storage Higher reliability The Good The Bad Difficult to implement HDFS-RAID: solved! The Ugly Repair Problem! Facebook has one of the largest Hadoop clusters >3000 machines >30 PB logical data 3x replication costly Facebook uses HDFS-RAID with (14, 10) Reed Solomon Code which we will call HDFS-RS. Every lost block needs 10 more blocks for repair! Network is bottlenecked So only 8% of cold data is encoded 5 file blocks 4 RS parity blocks 5 file blocks X 1 X 2 X 3 X 4 X 5 X 6 X 7 X 8 X 9 X 10 P 1 P 2 P 3 P 4 S 1 S 2 S 3 c 1 c 2 c 3 c 4 c 5 c 6 c 7 c 8 c 9 c 10 c 0 1 c 0 2 c 0 3 c 0 4 c 0 5 c 0 6 local parity block implied parity block local parity block 1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145) 0 50 100 150 HDFS Bytes Read (GB) Failure events # of lost DataNodes (Lost Blocks) HDFSRS HDFSXorbas 1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145) 0 50 100 150 200 250 300 Network Out Traffic (GB) Failure events # of lost DataNodes (Lost Blocks) HDFSRS HDFSXorbas Experiments over 50 node clusters from Amazon S3 Bytes read from the system for repair Network used for repair The Verdict Use 14% more storage as compared to RS (14, 10) code But repair uses half the network and half the disk Also provides better reliability! Locally Repairable Codes (LRC) LRC Codes to the rescue! Facebook’s HDFS-RAID is open source. We used it to develop our own version of Hadoop called HDFS-Xorbas*, which implements LRC codes We use a (14, 10, 2) LRC Code 2/14 = 14% extra storage but mitigates the repair problem LRC (14,10,2) Recipe: Split file into 10 blocks Then create 4 extra parity blocks using Reed Solomon encoding Use the first 5 and second 5 file blocks to create 2 “local parity blocks” S1 & S2 One lost block requires only 5 others blocks to be read. has to download only those blocks that were lost has to download other coded blocks to reconstruct the lost blocks
Transcript
Page 1: Novel Codes for Cloud Storage€¦ · n blocks (n,k) = (4,2) A1 A2 A3 A4 X1 X2 X1 X1 X2 X2 + + 2 Example Code = = = = (n,k) coding: •Split file in k blocks and then code into n

Novel Codes for Cloud StorageMaheswaran Sathiamoorthy*, Megasthenis Asteris*,

             Dimitris Papailiopoulos*, Alexandros G. Dimakis*,  Ramkumar Vadali**, Scott Chen**, Dhruba Borthakur**

* - USC, ** - Facebook

[email protected]*-code opensourced at http://github.com/madiator/hadoop-20

Cloud Storage Erasure Coding

Replication Coded Storage

Xorbas

Experiments and Results

Facebook clusters

• Thousands of machines in data centers• Failure is the norm rather than the

exception• To provide reliability, replication is used.

• each file is stored multiple times (generally thrice).

• replication costly, so could coding be an alternative?

• Hadoop: Distributed storage system, widely used.

AX1

X2

A1

A2

A3

A4

Split intok blocks

Code inton blocks

(n,k) = (4,2)

A1

A2

A3

A4

X1

X2

X1

X1

X2

X2

+

+ 2

Example Code

=

=

=

=

(n,k) coding: •Split file in k blocks and then code into n blocks•Any k of the n blocks enough to recover the file•e.g.: Reed Solomon codes

failure

Node 1

X1

Node 2

X2

Node 3

X1

Node 4

X2

Node 5

X1

Node 6

X2

New Node

X1

Can tolerate 2 failuresStorage overhead: 200%Repair overhead: 0%

failure

New Node

Node 1

A1

Node 2

A2

Node 3

A3

Node 4

A4

Can tolerate 2 failuresStorage overhead: 100%Repair overhead: 100%

A1

3x Replication (4,2) CodingThe Repair Problem:

(n,k) code requiresk blocks to beread for repairingone block

•Lower storage•Higher reliability

The Good

The Bad•Difficult to implement•HDFS-RAID: solved!

The Ugly•Repair Problem!

• Facebook has one of the largest Hadoop clusters• >3000 machines• >30 PB logical data

• 3x replication costly• Facebook uses HDFS-RAID with

(14, 10) Reed Solomon Code which we will call HDFS-RS.

• Every lost block needs 10 more blocks for repair!

• Network is bottlenecked• So only 8% of cold data is encoded

with 10 data blocks X1

, X2

, . . . , X10

and use a (10, 4)Reed-Solomon over a binary extension field F

2

m to con-struct 4 parity blocks P

1

, P2

, . . . , P4

. This is the codecurrently used in X production clusters that can toler-ate any 4 block failures due to the RS parities. Thebasic idea of LRCs is very simple: we make repair e�-cient by adding additional local parities. This is shownin figure 2.

5 file blocks 4 RS parity blocks5 file blocks

X1

X2

X3

X4

X5

X6

X7

X8

X9

X10

P1

P2

P3

P4

S1

S2

S3

c1

c2

c3

c4

c5

c6

c7

c8

c9

c10 c0

1

c02

c03

c04

c05

c06

local parity block implied parity blocklocal parity block

Figure 2: Locally repairable code implemented inHDFS-Xorbas. The four parity blocks P

1

, P2

, P3

, P4

areconstructed with a standard RS code and the local par-ities provide e�cient repair in the case of single blockfailures.

By adding the local parity S1

= c1

X1

+c2

X2

+c3

X3

+c4

X5

, a single block failure can be repaired by access-ing only 5 other blocks. For example, if block X

3

is lost(or degraded read while unavailable) it can be recon-structed by

X3

= c�1

3

(S1

� c1

X1

� c2

X2

� c4

X4

� c5

X5

). (1)

The multiplicative inverse of the field element c3

ex-ists as long as c

3

6= 0 which is the requirement we willenforce for all the local parity coe�cients. It turns outthat the coe�cients ci can be selected to guarantee thatall the linear equations will be linearly independent. Inthe Appendix we present a randomized and a deter-ministic algorithm to construct such coe�cients. Weemphasize that the complexity of the deterministic al-gorithm is exponential in the code parameters (n, k) andtherefore useful only for small code constructions.

The disadvantage of adding these local parities is theextra storage requirement. While the original RS codewas storing 14 blocks for every 10, the three local pari-ties increase the storage overhead into 17/10. There isone additional optimization that we can perform: Weshow that the coe�cients c

1

, c2

, . . . c10

can be chosen sothat the local parities satisfy an additional alignmentequation S1 + S2 + S3 = 0. We can therefore not storethe local parity S

3

and instead consider it an impliedparity. Note that to obtain this in the figure, we setc05

= c06

= 1.When a single block failure happens in a RS parity,

the implied parity can be reconstructed and used to

repair that failure. For example, if P2

is lost, it canbe recovered by reading 5 blocks P

1

, P3

, P4

, S1

, S2

andsolving the equation

P2

= (c02

)�1(�S1

� S2

� c01

P1

� c03

P3

� c04

P4

). (2)

In our theoretical analysis we show how to find non-zero coe�cients ci (that must depend on the parities Pi

but are not data dependent) for the alignment condi-tion to hold. We also show that for the Reed-Solomoncode implemented in HDFS RAID, choosing ci = 1 andtherefore performing simple XOR operations is su�-cient. We further prove that this code has the largestpossible distance (d = 5) for this given locality r = 5and blocklength n = 16.

3. SYSTEM DESCRIPTIONHDFS-RAID is an open source module that imple-

ments RS encoding and decoding over Apache Hadoop [3].It provides a Distributed Raid File system (DRFS) thatruns above HDFS. Files stored in DRFS are divided intostripes, i.e., groups of several blocks. For each stripe, anumber of parity blocks are calculated and stored as aseparate, parity file corresponding to the original file.HDFS-RAID is implemented in Java (approximately12,000 lines of code) and is currently used in produc-tion by several organizations, including social networkX.

The module consists of several components, amongwhich RaidNode and BlockFixer are the most relevanthere:• The RaidNode is a daemon responsible for the cre-

ation and maintenance of parity files for all data filesstored in the DRFS. One node in the cluster is gen-erally designated to run the RaidNode. The dae-mon periodically scans the HDFS file system and de-cides whether a file is to be RAIDed or not, basedon its size and age. In large clusters, RAIDing isdone in a distributed manner by assigning MapRe-duce jobs to nodes across the cluster. After encoding,the RaidNode lowers the replication level of RAIDedfiles to one.

• The BlockFixer is a separate process that runs atthe RaidNode and periodically checks for lost or cor-rupted blocks among the RAIDed files. When blocksare tagged as lost or corrupted, the BlockFixer re-builds them using the surviving blocks of the stripe,again, by dispatching repair MapReduce jobs.

Both RaidNode and BlockFixer rely on an underlyingcomponent: ErasureCode. ErasureCode implements theerasure encoding/decoding functionality. In X’s HDFS-RAID, an RS (10, 4) erasure code is implemented throughErasureCode (4 parity blocks are created for every 10data blocks).

3.1 HDFS-Xorbas

4

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

50

100

150

HD

FS B

ytes

Rea

d (G

B)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(a) HDFS Bytes Read per failure event.

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

50

100

150

200

250

300

Netw

ork

Out

Tra

ffic

(GB)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(b) Network Out Tra�c per failure event.

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

10

20

30

40

50

60

Rep

air D

urat

ion

(Min

utes

)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(c) Repair duration per failure event.

Figure 4: The metrics measured during the 200 file experiment. Network-in is similar to Network-out and so it is notdisplayed here. During the course of the experiment, we simulated eight failure events and the x-axis gives detailsof the number of DataNodes terminated during each failure event and the number of blocks lost are displayed inparentheses.

tinct events to be isolated. For example in Fig. 4 andFig. 5a we present measurements from the 200 file ex-periment. The other experiments involving 50 and 100files produce similar results and are not shown. Themeasurements of all the experiments are combined inFigure 6.

For every failure event, while selecting DataNodes tobe terminated for each cluster, we made sure that thetotal number of blocks lost were roughly the same forboth clusters. We followed this choice because our ob-jective was to compare the two systems for each blocklost. However, since Xorbas has an additional storageoverhead, a random failure event would in expectation,lead to loss of 14.3% more blocks in Xorbas comparedto RS. In any case, results can be adjusted to take thisinto account, without significantly a↵ecting the gainsobserved in our experiments.

Finally, in Figure 6, we present the measurements ofHDFS bytes read, network tra�c and repair durationversus the number of blocks lost, for all three experi-ments carried out in EC2. We also plot the linear leastsquares fitting curve for these measurements.

5.2.1 HDFS Bytes ReadFigure 4a depicts the total number of HDFS bytes

read by the BlockFixer jobs initiated during each fail-ure event. The bar plots show that HDFS-Xorbas reads41% � 52% the amount of data that RS reads to re-construct the same number of lost blocks. These mea-surements are consistent with the theoretically expectedvalues, given that more than one blocks per stripe areoccasionally lost (note that 12.14/5 = 41%). In Fig-ure 6a it is shown that the number of HDFS bytes readis linearly dependent on the number of blocks lost, asexpected. The slopes give us the average number ofHDFS bytes read per block for Xorbas and HDFS-RS.The average number of blocks read per lost block are

estimated to be 11.5 and 5.8, showing the 2⇥ benefit ofHDFS-Xorbas.

5.2.2 Network TrafficFigure 4b depicts the network tra�c produced by the

BlockFixer jobs during the entire repair procedure. Inparticular, it shows the outgoing network tra�c pro-duced in the cluster, aggregated across instances. In-coming network tra�c is similar since the cluster onlycommunicates information internally. Throughout ourexperiments, we consistently observed that network traf-fic was roughly equal to twice the number of bytes read.Therefore, gains in the number of HDFS bytes read, im-mediately translate to network tra�c gains. In Figure5a, we present the Network Tra�c plotted continuouslyduring the course of the 200 file experiment, with a5-minute resolution. The sequence of failure events isclearly visible. The fact that the tra�c peaks of the twosystems are di↵erent is an indication that the availablebandwidth was not saturated. However, the bottleneckin MapReduce tasks is reportedly the network [5, 16,17]. This is due to the fact that when the amount ofdata increases, more MapReduce tasks need to run inparallel, draining network resources. In these large scaleenvironments, link saturation is expected to limit thedata transfer rates and we expect higher recovery timesfor HDFS-RS.

5.2.3 Repair DurationFigure 4c depicts the total duration of the recov-

ery procedure i.e., the interval from the launch timeof the first block fixing job to the termination of thelast one. Combining measurements from all the exper-iments, Figure 6c shows the repair duration versus thenumber of blocks repaired. These figures show that Xor-bas finishes 25% to 45% faster than HDFS-RS. This isprimarily due to the reduced amount of data that need

7

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

50

100

150

HD

FS B

ytes

Rea

d (G

B)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(a) HDFS Bytes Read per failure event.

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

50

100

150

200

250

300

Netw

ork

Out

Tra

ffic

(GB)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(b) Network Out Tra�c per failure event.

1( 62) 1( 71) 1( 71) 1( 64) 3(182) 3(209) 2(138) 2(145)0

10

20

30

40

50

60

Rep

air D

urat

ion

(Min

utes

)

Failure events − # of lost DataNodes (Lost Blocks)

HDFS−RSHDFS−Xorbas

(c) Repair duration per failure event.

Figure 4: The metrics measured during the 200 file experiment. Network-in is similar to Network-out and so it is notdisplayed here. During the course of the experiment, we simulated eight failure events and the x-axis gives detailsof the number of DataNodes terminated during each failure event and the number of blocks lost are displayed inparentheses.

tinct events to be isolated. For example in Fig. 4 andFig. 5a we present measurements from the 200 file ex-periment. The other experiments involving 50 and 100files produce similar results and are not shown. Themeasurements of all the experiments are combined inFigure 6.

For every failure event, while selecting DataNodes tobe terminated for each cluster, we made sure that thetotal number of blocks lost were roughly the same forboth clusters. We followed this choice because our ob-jective was to compare the two systems for each blocklost. However, since Xorbas has an additional storageoverhead, a random failure event would in expectation,lead to loss of 14.3% more blocks in Xorbas comparedto RS. In any case, results can be adjusted to take thisinto account, without significantly a↵ecting the gainsobserved in our experiments.

Finally, in Figure 6, we present the measurements ofHDFS bytes read, network tra�c and repair durationversus the number of blocks lost, for all three experi-ments carried out in EC2. We also plot the linear leastsquares fitting curve for these measurements.

5.2.1 HDFS Bytes ReadFigure 4a depicts the total number of HDFS bytes

read by the BlockFixer jobs initiated during each fail-ure event. The bar plots show that HDFS-Xorbas reads41% � 52% the amount of data that RS reads to re-construct the same number of lost blocks. These mea-surements are consistent with the theoretically expectedvalues, given that more than one blocks per stripe areoccasionally lost (note that 12.14/5 = 41%). In Fig-ure 6a it is shown that the number of HDFS bytes readis linearly dependent on the number of blocks lost, asexpected. The slopes give us the average number ofHDFS bytes read per block for Xorbas and HDFS-RS.The average number of blocks read per lost block are

estimated to be 11.5 and 5.8, showing the 2⇥ benefit ofHDFS-Xorbas.

5.2.2 Network TrafficFigure 4b depicts the network tra�c produced by the

BlockFixer jobs during the entire repair procedure. Inparticular, it shows the outgoing network tra�c pro-duced in the cluster, aggregated across instances. In-coming network tra�c is similar since the cluster onlycommunicates information internally. Throughout ourexperiments, we consistently observed that network traf-fic was roughly equal to twice the number of bytes read.Therefore, gains in the number of HDFS bytes read, im-mediately translate to network tra�c gains. In Figure5a, we present the Network Tra�c plotted continuouslyduring the course of the 200 file experiment, with a5-minute resolution. The sequence of failure events isclearly visible. The fact that the tra�c peaks of the twosystems are di↵erent is an indication that the availablebandwidth was not saturated. However, the bottleneckin MapReduce tasks is reportedly the network [5, 16,17]. This is due to the fact that when the amount ofdata increases, more MapReduce tasks need to run inparallel, draining network resources. In these large scaleenvironments, link saturation is expected to limit thedata transfer rates and we expect higher recovery timesfor HDFS-RS.

5.2.3 Repair DurationFigure 4c depicts the total duration of the recov-

ery procedure i.e., the interval from the launch timeof the first block fixing job to the termination of thelast one. Combining measurements from all the exper-iments, Figure 6c shows the repair duration versus thenumber of blocks repaired. These figures show that Xor-bas finishes 25% to 45% faster than HDFS-RS. This isprimarily due to the reduced amount of data that need

7

Experiments over 50 node clustersfrom Amazon S3

Bytes read from the system for repairNetwork used for repair

The Verdict•Use 14% more storage as compared to RS (14, 10) code•But repair uses

•half the network•and half the disk

•Also provides better reliability!

Locally Repairable Codes (LRC)•LRC Codes to the rescue!•Facebook’s HDFS-RAID is open source.

•We used it to develop our own version of Hadoop called HDFS-Xorbas*, which implements LRC codes

•We use a (14, 10, 2) LRC Code•2/14 = 14% extra storage

•but mitigates the repair problem

LRC (14,10,2) Recipe:•Split file into 10 blocks•Then create 4 extra parity blocks using Reed Solomon encoding•Use the first 5 and second 5 file blocks to create 2 “local parity blocks” S1 & S2•One lost block requires only 5 others blocks to be read.

has to download onlythose blocks that were lost

has to download other coded blocksto reconstruct the lost blocks

Recommended