Erasure coding: split, lose, rebuild
In the book: Chapter 13
Lab
Erasure coding: split, lose, rebuild
Split a text into k data chunks and m parity chunks, fail any shards you like, and see which chunks are read and how the text comes back by inverting a matrix in GF(2⁸).
4 / 6shards healthy
0more failures tolerated
13 B × 6chunk size
1.5×storage overhead (k+m)/k
52 Bread to rebuild one shard
shard 0 data
43 65 70 68 20 6b 65 65 70 73 20 65 …
“Ceph keeps ev”
Read for this requestshard 1 data
lost
This shard's OSD is downshard 2 data
66 65 2c 20 6f 6e 65 20 63 68 75 6e …
“fe, one chunk”
Read for this requestshard 3 data
20 61 74 20 61 20 74 69 6d 65 2e 00 …
“ at a time.··”
Read for this requestshard 4 parity
lost
This shard's OSD is downshard 5 parity
11 27 b5 b5 70 17 bf 40 68 29 c4 26 …
Read for this requestRebuilt from shards 0, 2, 3, 5 ✓
Ceph keeps every object safe, one chunk at a time.
Inverse matrix (rows of the shards read)
| D0 | 1 | 0 | 0 | 0 |
|---|---|---|---|---|
| D1 | 142 | 2 | 4 | 142 |
| D2 | 0 | 1 | 0 | 0 |
| D3 | 0 | 0 | 1 | 0 |
isa coding matrix (parity rows)
| P4 | 1 | 1 | 1 | 1 |
|---|---|---|---|---|
| P5 | 1 | 2 | 4 | 8 |
Pi[b] = ⊕j M[i][j] · Dj[b] in GF(2⁸), polynomial 0x11d · read for decode: {0,2,3,5} (all data shards if present, else the first k available) · rebuilding one lost shard reads k = 4 chunks
With 3x replication, rebuilding a copy reads one copy; with EC k chunks must be read from k OSDs, so repair costs more and a large k makes it worse (chapter 13). Once a data chunk is lost, even a normal read has to decode.
Follows:
jerasure src/reed_sol.c :: reed_sol_vandermonde_coding_matrix, reed_sol_big_vandermonde_distribution_matrixThe jerasure coding matrixisa-l erasure_code/ec_base.c :: gf_gen_rs_matrix, ec_encode_data_baseThe ISA-L matrix and encodersrc/erasure-code/ErasureCode.cc :: ErasureCode::_minimum_to_decodeWhich chunks a read needssrc/erasure-code/jerasure/ErasureCodeJerasure.cc, src/erasure-code/isa/ErasureCodeIsa.cc :: technique=reed_sol_vanThe jerasure and isa pluginssrc/common/options/global.yaml.in :: osd_pool_default_erasure_code_profile (plugin=isa technique=reed_sol_van k=2 m=2)The default profile