Upgrade to Pro — share decks privately, control downloads, hide ads and more …

HTTP/2 最速実装 v3

Ryo Okubo
September 06, 2014

HTTP/2 最速実装 v3

Ryo Okubo

September 06, 2014
Tweet

More Decks by Ryo Okubo

Other Decks in Programming

Transcript

  1. )551Yͷϔομ w ςΩετͰϔομΛ΍ΓऔΓ w ϔομͱϘσΟͷ۠੾Γ͸ۭվߦ w 6TFS"HBOUͳͲ΄ͱΜͲมΘΒͳ͍ͷʹԿ౓΋ૹ৴͢Δඞཁ͕͋Γɺ৑௕ (&5)551 )PTUMPDBMIPTU "DDFQU

      $3 -' )5510, 4FSWFSOHJOY %BUF'SJ 4FQ(.5 $POUFOU5ZQFUFYUIUNM $POUFOU-FOHUI -BTU.PEJpFE'SJ 4FQ(.5 $POOFDUJPOLFFQBMJWF &5BHBGF "DDFQU3BOHFTCZUFT $3 -' ϦΫΤετϔομͷྫ Ϩεϙϯεϔομͷྫ
  2. )551ͷಛ௃ w ࿦ཧతͳίωΫγϣϯ ετϦʔϜ ʹΑΔฒྻ௨৴ w ݪଇతʹίωΫγϣϯ͸ຊ͚ͩுΔ w ϝοηʔδΛόΠφϦϑϨʔϜͰදݱ w

    ϔομΛಠࣗͷܗࣜͰѹॖ )1"$,  w αʔό͔Βͷࣗൃతͳ௨৴ αʔόϓογϡ  w ετϦʔϜͷ༏ઌ౓෇͚
  3. ετϦʔϜ w ͭͷίωΫγϣϯ͚ͩுΓɺͦͷ্ͰετϦʔϜΛ։͘ w )551௨৴͸ετϦʔϜ্ͰߦΘΕΔ w ετϦʔϜͷॲཧ͸ϒϩοΫ͠߹Θͳ͍ w ετϦʔϜʹ͸Ұҙͳ*%͕ৼΒΕΔ w

    ΫϥΠΞϯτ͔Β։͘৔߹ح਺ɺαʔό͔Β։͘৔߹ۮ਺Λ࢖༻ w 4USFBN*%͸؅ཧ༻ʹ࢖༻͞ΕΔ server client TCP  HTTP/2   HTTP/20  HTTP/20  
  4. ϑϨʔϜλΠϓ w ϑϨʔϜ͸༻్ʹԠͯ͡Լهͷ༷ʹ෼ྨ͞ΕΔ w %"5" ϘσΟΛදݱ  w )&"%&34 ϔομΛදݱ

     w 13*03*5: ετϦʔϜͷ༏ઌ౓ઃఆ  w 345@453&". ετϦʔϜΛҟৗऴྃ  w 4&55*/(4 ίωΫγϣϯͷઃఆ  w 164)@130.*4& αʔόϓογϡͷ௨஌  w 1*/( ίωΫγϣϯͷࢮ׆֬ೝ  w (0"8": ίωΫγϣϯͷऴྃ௨஌  w 8*/%08@61%"5& ϑϩʔ੍ޚ  w $0/5*/6"5*0/ )&"%&34ʹೲ·Βͳ͍෼ͷϔομͷૹ৴
  5. ࠷଎࣮૷Ͱ΍Δ΂͖ൣғ w όΠφϦϑϨʔϜॲཧ w ಛఆछྨͷϑϨʔϜ͚ͩ΍Γ·͢ w %"5" )&"%&34 4&55*/(4 (0"8":

    w ετϦʔϜ؅ཧ w αϘΓ·͢ɻTUSFBNJE͚ͩΛ࢖༻ w ঢ়ଶ΋؅ཧ͠ͳ͍ɻ͋ΔॱংͰϑϨʔϜ͕དྷΔ͜ͱΛ૝ఆɻ w ϔομѹॖ w αϘΓ·͢ɻFODPEF͚ͩ͸)1"$,ͷϑΥʔϚοτʹͳΔ΂͘߹Θͤ·͢ɻ
  6. ࠷଎࣮૷ʹΑΔ ΫϥΠΞϯταʔόͷ΍ΓऔΓ server client 0.,$"& % 1.,Connec0on,Preface( 24,octets,),  2.,

    ,SETTINGS,frame,  3.,SETTINGS,frame ACK  5.,HEADERS,frame !   6.,HEADERS,frame,(#%)  7.,DATA,frame,(#%)  8.,GOAWAY,frame,  4.,ACK 
  7. ϓϩτίϧ ωΰγΤʔγϣϯ w )551Λ࢖͏ࣄΛDMJFOUTFSWFSؒͰͲ͏ܾఆ͢Δ͔ʁ w ਅ໘໨ʹ΍Δ৔߹ w IUUQTͳΒ5-4/1/PS5-4"-1/ w IUUQͳΒ6QHSBEF

    "MU4WD w ࠷଎࣮૷Ͱ͸%JSFDU ωΰγΤʔγϣϯ͠ͳ͍ Ͱߦ͖·͢ w ૬ख͕)551͠Ό΂ΕΔ૝ఆͰ௨৴
  8.  4&55*/(4GSBNF w ίωΫγϣϯશମʹؔΘΔઃఆΛ΍ΓऔΓ͢Δ w αʔόϓογϡڐՄɺಉ࣌ετϦʔϜͷ࠷େ਺ͳͲ w ϖΠϩʔυ͸ۭ ϑϨʔϜͷMFOHUI Ͱ΋Α͍

    w ϖΠϩʔυͷϑΥʔϚοτ͸Լهͷ௨Γ ! w ࢀߟIUUQTVNNFSXJOEKQEPDTESBGUJFUGIUUQCJTIUUQTFDUJPO
  9. )1"$,ΤϯίʔυͷΠϝʔδ w ϑΥʔϚοτ͸ࠨԼͷਤͷ௨Γ w )͸ϋϑϚϯූ߸Խϑϥάɻʹ͓ͯ͘͠ w -FOHUIͷ  ͸೚ҙ௕ɻࠓճ͸Ϗοτʹೲ·Δ૝ఆͰ࣮૷ɻ w

    ਅ໘໨ʹ࣮૷͢ΔͳΒ*OUFHFS3FQSFTFOUBUJPOΛࢀর w 4USJOHͷ෦෼͸"4$**ίʔυΛೖΕΔ w /BNF͕lNFUIPEzɺ7BMVF͕l(&5zͷ৔߹ɺӈͷΠϝʔδͷΑ͏ʹ͢Δ -JUFSBM)FBEFS'JFMEXJUIPVU*OEFYJOHϑΥʔϚοτ         cccccc     ccc    clNFUIPEzc    ccc    cl(&5zc  ΤϯίʔυޙͷΠϝʔδ 4USJOH෦෼͸࣮ࡍʹ͸จࣈྻ෼ͷPDUFUΛ࢖༻
  10. ಈ࡞֬ೝํ๏ w ΫϥΠΞϯτΛ࣮૷͢Δ৔߹ w 1VCMJD5FTU4FSWFSΛ࢖͏ w IUUQTOHIUUQPSH w OHIUUQEΛ࢖͏ %PDLFSJNBHF༻ҙ͠·ͨ͠

     w ࠷଎࣮૷αʔόΛ࢖͏ w αʔόΛ࣮૷͢Δ৔߹ w OHIUUQ ΫϥΠΞϯτ࣮૷ Λ࢖͏ %PDLFSJNBHF༻ҙ͠·ͨ͠  w ࠷଎࣮૷ΫϥΠΞϯτΛ࢖͏
  11. ࢀߟࢿྉ w IUUQESBGU೔ຊޠ༁ w IUUQTVNNFSXJOEKQEPDTESBGUJFUGIUUQCJTIUUQ w )1"$,ESBGU w IUUQUPPMTJFUGPSHIUNMESBGUJFUGIUUQCJTIFBEFS DPNQSFTTJPO

    w )551ϋοΧιϯୈҰճɺୈೋճͷࢿྉ w IUUQXXXTMJEFTIBSFOFU,BPSV.BFEBIUUQTJNQMF w IUUQXXXTMJEFTIBSFOFU:PTIJIJSP*XBOBHBIUUQ