1. Ceph最新的EC-CLAY插件調(diào)研-上

        共 1968字,需瀏覽 4分鐘

         ·

        2020-12-20 20:32

        CLAY 簡介

        Clay Codes ( Clay Codes: Moulding MDS Codes to Yield an MSR Code ) 是FAST18 上提出的一種編碼方法,文章地址,Clay 碼能夠?qū)⒁话愕腗DS 碼(最優(yōu)容錯)轉(zhuǎn)化為具有最優(yōu)修復(fù)的編碼方法,具有以下性質(zhì):

        Minimum Storage (最小存儲開銷,同經(jīng)典RS碼和最小存儲再生碼,MSR)
        Maximum Failure Tolerance(最大容錯,即 (n,k)-Clay 碼可以容任意n-k 失效)
        Optimal Repair Bandwidth (最優(yōu)修復(fù)開銷,能夠達(dá)到理論最優(yōu)值)
        All-Node Optimal Repair (最小開銷修復(fù)所有節(jié)點(diǎn)的數(shù)據(jù),包括原始數(shù)據(jù)和校驗(yàn)數(shù)據(jù))
        Disk Read Optimal (最優(yōu)磁盤讀)
        Low Sub-packetization (低分包數(shù),即碼字長度短)

        參考資料1:http://blog.foool.net/2018/05/clay-codes-%E4%BB%8E%E7%94%9F%E6%88%90%E7%9F%A9%E9%98%B5%E7%9A%84%E8%A7%92%E5%BA%A6%E6%9D%A5%E7%9C%8B/

        參考資料2:https://blog.acolyer.org/2018/03/01/clay-codes-moulding-mds-codes-to-yield-an-msr-code/

        ceph官方的介紹,可以確認(rèn)以下幾點(diǎn):

        • 向下兼容:CLAY插件與jerasure、ISA、SHEC插件兼容,這里可以理解為Clay是在這幾個插件的基礎(chǔ)上做的一層更高層面的數(shù)據(jù)組成抽象,能夠更加細(xì)致的控制數(shù)據(jù)的分布粒度,從而實(shí)現(xiàn)對原有的幾個插件在數(shù)據(jù)恢復(fù)場景下的性能優(yōu)化。這也就是是上面提到的“Clay 碼能夠?qū)⒁话愕腗DS 碼(最優(yōu)容錯)轉(zhuǎn)化為具有最優(yōu)修復(fù)的編碼方法”。

        • 修復(fù)性能優(yōu)化"在底層已有的jerasure、ISA、SHEC幾個的插件基礎(chǔ)上,做了編碼優(yōu)化,能夠在異常發(fā)生,需要進(jìn)行數(shù)據(jù)恢復(fù)的情況下顯著的降低磁盤&網(wǎng)絡(luò)帶寬的消耗。這個也是CLAY EC插件的最大價值所在。

        • 從Ceph 14版本開始提供,理論上這個特性可以向下backport到低版本。

        從clay插件的初始化配置部分的函數(shù)實(shí)現(xiàn),也能看到一些與其他插件在兼容適配上的限制

        #src/erasure-code/clay/ErasureCodeClay.cc

        int?ErasureCodeClay::parse(ErasureCodeProfile?&profile,
        ???????????????ostream?*ss)
        {
        ??int?err?=?0;
        ??err?=?ErasureCode::parse(profile,?ss);
        ??err?|=?to_int("k",?profile,?&k,?DEFAULT_K,?ss);
        ??err?|=?to_int("m",?profile,?&m,?DEFAULT_M,?ss);

        ??err?|=?sanity_check_k_m(k,?m,?ss);

        ??err?|=?to_int("d",?profile,?&d,?std::to_string(k+m-1),?ss);

        ??//?check?for?scalar_mds?in?profile?input
        ?//默認(rèn)采用jerasure插件進(jìn)行編碼
        ??if?(profile.find("scalar_mds")?==?profile.end()?||
        ??????profile.find("scalar_mds")->second.empty())?{?
        ????mds.profile["plugin"]?=?"jerasure";?
        ????pft.profile["plugin"]?=?"jerasure";
        ??}?else?{
        ????std::string?p?=?profile.find("scalar_mds")->second;
        ???//底層只支持jerasure、isa、shec三種插件
        ????if?((p?==?"jerasure")?||?(p?==?"isa")?||?(p?==?"shec"))?{
        ??????mds.profile["plugin"]?=?p;?
        ??????pft.profile["plugin"]?=?p;
        ????}?else?{
        ????????*ss?<"scalar_mds?"?<"plugin"]?<<
        ???????????????"is?not?currently?supported,?use?one?of?'jerasure',"<<
        ???????????????"?'isa',?'shec'"?<std::endl;
        ????????err?=?-EINVAL;
        ????????return?err;
        ????}
        ??}



        ??if?(profile.find("technique")?==?profile.end()?||
        ??????profile.find("technique")->second.empty())?{
        ????if?((mds.profile["plugin"]=="jerasure")?||?(mds.profile["plugin"]=="isa")?)?{
        ??????mds.profile["technique"]?=?"reed_sol_van";
        ??????pft.profile["technique"]?=?"reed_sol_van";
        ????}?else?{
        ??????mds.profile["technique"]?=?"single";
        ??????pft.profile["technique"]?=?"single";
        ????}
        ??}?else?{
        ????std::string?p?=?profile.find("technique")->second;
        ????//Supported?techniques?are?‘reed_sol_van’,?‘reed_sol_r6_op’,‘cauchy_orig’,?‘cauchy_good’,?‘liber8tion’?for?jerasure,?
        ????if?(mds.profile["plugin"]?==?"jerasure")?{
        ??????if?(?(p?==?"reed_sol_van")?||?(p?==?"reed_sol_r6_op")?||?(p?==?"cauchy_orig")
        ???????????||?(p?==?"cauchy_good")?||?(p?==?"liber8tion"))?{
        ????????mds.profile["technique"]?=?p;
        ????????pft.profile["technique"]?=?p;
        ??????}?else?{
        ????????*ss?<"technique?"?<"is?not?currently?supported,?use?one?of?"
        ????????<"reed_sol_van',?'reed_sol_r6_op','cauchy_orig',"
        ????????<"'cauchy_good','liber8tion'"<std::endl;
        ????????err?=?-EINVAL;
        ????????return?err;
        ??????}
        ??????//‘reed_sol_van’,?‘cauchy’?for?isa?
        ????}?else?if?(mds.profile["plugin"]?==?"isa")?{
        ??????if?(?(p?==?"reed_sol_van")?||?(p?==?"cauchy"))?{
        ????????mds.profile["technique"]?=?p;
        ????????pft.profile["technique"]?=?p;
        ??????}?else?{
        ????????*ss?<"technique?"?<"is?not?currently?supported,?use?one?of"
        ????????<"'reed_sol_van','cauchy'"<std::endl;
        ????????err?=?-EINVAL;
        ????????return?err;
        ??????}
        ????}?else?{
        ????//?‘single’,‘multiple’?for?shec.
        ??????if?(?(p?==?"single")?||?(p?==?"multiple"))?{
        ????????mds.profile["technique"]?=?p;
        ????????pft.profile["technique"]?=?p;
        ??????}?else?{
        ????????*ss?<"technique?"?<"is?not?currently?supported,?use?one?of"<<
        ???????????????"'single','multiple'"<std::endl;
        ????????err?=?-EINVAL;
        ????????return?err;
        ??????}
        ????}
        ??}
        ??if?((d??k?+?m?-?1))?{
        ????*ss?<"value?of?d?"?<????????<"?must?be?within?[?"?<","?<-1?<"]"?<std::endl;
        ????err?=?-EINVAL;
        ????return?err;
        ??}

        ??q?=?d?-?k?+?1;
        ??if?((k?+?m)?%?q)?{
        ????nu?=?q?-?(k?+?m)?%?q;
        ??}?else?{
        ????nu?=?0;
        ??}
        //注意分塊規(guī)則限定k+m+nu總和不能超過254
        ??if?(k+m+nu?>?254)?{
        ????err?=?-EINVAL;
        ????return?err;
        ??}

        ??if?(mds.profile["plugin"]?==?"shec")?{
        ????mds.profile["c"]?=?'2';
        ????pft.profile["c"]?=?'2';
        ??}
        ??mds.profile["k"]?=?std::to_string(k+nu);
        ??mds.profile["m"]?=?std::to_string(m);
        ??mds.profile["w"]?=?'8';

        ??pft.profile["k"]?=?'2';
        ??pft.profile["m"]?=?'2';
        ??pft.profile["w"]?=?'8';

        ??t?=?(k?+?m?+?nu)?/?q;
        ??sub_chunk_no?=?pow_int(q,?t);

        ??dout(10)?<???????<"?(q,t,nu)=("?<","?<","?<")"?<
        ??return?err;
        }

        故障恢復(fù)時的帶寬&磁盤消耗對比

        以EC場景下,假設(shè) d = 發(fā)生故障時,需要參與數(shù)據(jù)恢復(fù)的OSD數(shù)量
        在jerasure配置 k=8 m=4的情況下,發(fā)生一塊磁盤故障,需要讀取d=8磁盤才能完成數(shù)據(jù)的恢復(fù)。如果需要恢復(fù)的數(shù)據(jù)的容量為1G,那么需要總共讀取 8 x 1 GB = 8GB的數(shù)據(jù)容量(這也意味著需要同時通過網(wǎng)絡(luò)傳輸8GB的數(shù)據(jù))。
        在clay的插件配置中,d的設(shè)置需要滿足 k+1 <= d <= k+m-1 的限制,為了滿足使d最大化節(jié)省磁盤和網(wǎng)絡(luò)帶寬消耗,clay選取d=k+m-1作為默認(rèn)配置。在k=8,m=4的場景下,根據(jù)公式推導(dǎo)可以得到d=8+4-1=11。其中磁盤需要恢復(fù)的數(shù)據(jù)量計算公式如下。其中K為故障時刻需要恢復(fù)的數(shù)據(jù)總量。


        當(dāng)一個osd故障時,d=11,以需要恢復(fù)的數(shù)據(jù)總量為1GB為例,此時需要恢復(fù)下載的磁盤數(shù)據(jù)總量為

        jerasure/isa=?8*?1GB?=?8GB
        caly?=?(11*1GB)/(11-8+1)?=?11?/?4?=?2.75GB

        對比看到caly能夠顯著的減少磁盤讀取數(shù)據(jù)和網(wǎng)絡(luò)傳輸帶寬的消耗,caly只用到了isa一類插件的的2.75/8≈34%的資源消耗。

        同樣的場景下,以k=4,m=2為例,此時d=4+2-1=5,caly只用到了isa一類插件的的2.5/4≈62.5%的資源消耗。

        jerasure/isa=?4*?1GB?=?4GB
        caly?=?(5*1GB)/(5-4+1)?=?5?/?2?=?2.5GB

        依次類推,匯總表格如下:

        名稱KMD3副本得盤率EC得盤率硬件成本節(jié)約比率磁盤數(shù)據(jù)遷移量(ISA)磁盤數(shù)據(jù)遷移量(CLAY)數(shù)據(jù)恢復(fù)負(fù)載降低比率4M sub-chunk size(KB)sub-chunk count
        2+121233.3333333366.6666666720022020481
        2+222333.333333335015021.5255124
        3+131333.33333333752253301365.3333331
        3+232433.33333333601803233.33333333170.66666678
        3+333533.333333335015031.66666666744.44444444151.70370379
        4+141433.333333338024044010241
        4+242533.3333333366.6666666720042.537.51288
        4+343633.3333333357.14285714171.4285714425037.9259259327
        4+444733.333333335015041.7556.256416
        5+151533.3333333383.33333333250550819.21
        5+252633.3333333371.42857143214.2857143534051.216
        5+353733.3333333362.5187.552.33333333353.3333333330.3407407427
        5+454833.3333333355.55555556166.6666667526012.864
        5+555933.333333335015051.86432.76825
        6+161633.3333333385.71428571257.1428571660682.66666671
        6+262733.333333337522563.541.6666666742.6666666716
        6+363833.3333333366.6666666720062.66666666755.5555555625.2839506227
        6+464933.333333336018062.2562.510.6666666764
        6+5651033.3333333354.54545455163.63636366266.666666675.461333333125
        6+6661133.333333335015061.83333333369.4444444418.9629629636
        7+171733.3333333387.5262.5770585.14285711
        7+272833.3333333377.77777778233.33333337442.8571428618.2857142932
        7+373933.33333333702107357.142857147.22398589181
        7+4741033.3333333363.63636364190.909090972.564.285714299.14285714364
        7+5751133.3333333358.3333333317572.268.571428574.681142857125
        7+6761233.3333333353.84615385161.53846157271.428571432.708994709216
        7+7771333.333333335015071.85714285773.4693877611.9416909649
        8+181833.3333333388.88888889266.66666678805121
        8+282933.333333338024084.543.751632
        8+3831033.3333333372.72727273218.181818283.33333333358.333333336.32098765481
        8+4841133.3333333366.6666666720082.7565.625864
        8+5851233.3333333361.53846154184.615384682.4704.096125
        8+6861333.3333333357.14285714171.428571482.16666666772.916666672.37037037216
        8+7871433.3333333353.3333333316082751.49271137343
        8+8881533.333333335015081.87576.5625864
        9+191933.3333333390270990455.11111111
        9+2921033.3333333381.81818182245.45454559544.444444447.11111111164
        9+3931133.333333337522593.66666666759.259259265.61865569381
        9+4941233.3333333369.23076923207.69230779366.666666671.777777778256
        9+5951333.3333333364.28571429192.857142992.671.111111113.640888889125
        9+6961433.333333336018092.33333333374.074074072.106995885216
        9+7971533.3333333356.25168.7592.14285714376.190476191.326854551343
        9+8981633.3333333352.94117647158.82352949277.777777780.888888889512
        9+9991733.333333335015091.88888888979.012345685.61865569381
        10+11011033.3333333390.90909091272.727272710100409.61
        10+21021133.3333333383.33333333250105.5456.464
        10+31031233.3333333376.92307692230.7692308104601.685596708243
        10+41041333.3333333371.42857143214.2857143103.2567.51.6256
        10+51051433.3333333366.66666667200102.8723.2768125
        10+61061533.3333333362.5187.5102.5751.896296296216
        10+71071633.3333333358.82352941176.4705882102.28571428677.142857141.194169096343
        10+81081733.3333333355.55555556166.6666667102.12578.750.8512
        10+91091833.3333333352.63157895157.8947368102800.561865569729
        10+1010101933.3333333350150101.9814.096100
        11+11111133.3333333391.6666666727511110372.36363641
        11+21121233.3333333384.61538462253.846153811645.454545452.909090909128
        11+31131333.3333333378.57142857235.7142857114.33333333360.606060611.532360643243
        11+41141433.3333333373.33333333220113.568.181818181.454545455256
        11+51151533.3333333368.75206.2511372.727272730.595781818625
        11+61161633.3333333364.70588235194.1176471112.66666666775.757575761.723905724216
        11+71171733.3333333361.11111111183.3333333112.42857142977.922077921.085608269343
        11+81181833.3333333357.89473684173.6842105112.2579.545454550.727272727512
        11+91191933.3333333355165112.11111111180.808080810.510786881729
        11+1011102033.3333333352.38095238157.142857111281.818181820.3723636361000
        11+1111112133.3333333350150111.90909090982.64462813.077385424121
        11+1211122233.3333333347.82608696143.4782609111.83333333383.333333332.585858586144
        12+11211233.3333333392.30769231276.923076912120341.33333331
        12+21221333.3333333385.71428571257.1428571126.545.833333332.666666667128
        12+31231433.3333333380240124.66666666761.111111111.404663923243
        12+41241533.3333333375225123.7568.751.333333333256
        12+51251633.3333333370.58823529211.7647059123.273.333333330.546133333625
        12+61261733.3333333366.66666667200122.83333333376.388888891.580246914216
        12+71271833.3333333363.15789474189.4736842122.57142857178.571428570.995140914343
        12+81281933.3333333360180122.37580.208333330.666666667512
        12+91292033.3333333357.14285714171.4285714122.22222222281.481481480.468221308729
        12+1012102133.3333333354.54545455163.6363636122.182.50.3413333331000
        12+1112112233.3333333352.17391304156.521739112283.333333330.2564487851331
        12+1212122333.3333333350150121.91666666784.027777782.37037037144


        瀏覽 45
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報
        評論
        圖片
        表情
        推薦
        點(diǎn)贊
        評論
        收藏
        分享

        手機(jī)掃一掃分享

        分享
        舉報
          
          

            1. 91麻豆天美京东蜜桃传媒老牛 | 天天宗合网 | 青娱乐成人 | juy824一色桃子在线观看 | 五月天婷婷网av av色偷偷 |