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

Fastlyのプログラマから見たCDN

kazuho
April 13, 2018

 Fastlyのプログラマから見たCDN

#cdn_study 発表資料 (2018/4/13)

kazuho

April 13, 2018
Tweet

More Decks by kazuho

Other Decks in Technology

Transcript

  1. 'BTUMZͷϓϩάϥϚ͔Βݟͨ$%/
    Ԟ Ұึ
    ೥݄

    View full-size slide


  2. • ೥૑ۀͷ$%/
    • ໿ਓͷैۀһ
    • ੈք̓ϲॴʹΦϑΟε
    • 5CQTͷόϯυ෯
    'BTUMZͱ͸

    View full-size slide


  3. • ೥݄ೖࣾ
    • 1SJODJQBM044&OHJOFFS
    – )551 5-4 26*$࣮૷ʮ)0ʯͷ։ൃ
    – ͦΕΒϓϩτίϧͷඪ४Խ׆ಈʹࢀՃ
    ࣗݾ঺հ

    View full-size slide


  4. ຊ೔͓࿩͢Δ಺༰͸$%/ͷதͷΤϯδχΞ
    ͔ΒݟͨݸਓతҙݟͰ͋Γɺࣾͱͯ͠ͷݟ
    ղΛࣔ͢΋ͷͰ͸͋Γ·ͤΜ
    ͓͜ͱΘΓ

    View full-size slide


  5. • 'BTUMZͷ101ઃܭ
    • શੈքతͳ෼ࢄ,74
    • &EHF$MPVE
    • ΠϯλʔωοτͷਐԽͱ$%/
    ΞδΣϯμ

    View full-size slide


  6. 'BTUMZͷ101ઃܭ

    View full-size slide


  7. $%/ʹΩϟογϡͤͨ͞΄͏͕଎͍
    $%/ʹΩϟογϡͤͨ͞΄͏͕͍҆
    ˣ
    Ωϟογϡώοτ཰ΛߴΊ͍ͨ
    $%/Λ࢖͏ཧ༝

    View full-size slide


  8. IUUQTXXXGBTUMZDPNOFUXPSLNBQ
    101T

    View full-size slide


  9. • ίϯϏχϞσϧ
    – Ϣʔβͷۙ͘ʹͨ͘͞Μͷ101
    – ϝϦοτ௿ϨΠςϯγ
    • εʔύʔϚʔέοτϞσϧ
    – *9ͷۙ͘ʹڊେͳ101
    – ϝϦοτΩϟογϡώοτ཰ߴ
    ̎छྨͷϞσϧ

    View full-size slide


  10. • Ωϟογϡώοτ͠ͳ͍ͳΒϨΠςϯγ
    Λ࡟Δҙຯ͕ͳ͍
    • ਺NTϨΠςϯγ͕૿͑Δͱͯ͠΋ɺώο
    τ཰ͷߴ͍ڊେͳ101Λ഑ஔ͢΂͖
    ˣ
    ڊେͳ101ͳΒͰ͸ͷٕज़త՝୊ͱ͸
    'BTUMZ͸εʔύʔϚέοτϞσϧ

    View full-size slide


  11. • 101ຖͷΩϟύγςΟ ྫ

    – ࠷େ5CQTΫϥεͷωοτϫʔΫ
    • ໿.314
    – ୆ͷαʔόΫϥελ
    • (#ϝϞϦ
    • 5#44%
    • νϟϨϯδίετͱߴՄ༻ੑ
    'BTUMZͷ101

    View full-size slide


  12. ϧʔςΟϯά

    View full-size slide


  13. IUUQTXXXGBTUMZDPNCMPHCVJMEJOHBOETDBMJOHGBTUMZOFUXPSLQBSUGJHIUJOHGJC
    ϧʔλϨεɾϧʔςΟϯά

    View full-size slide


  14. ϩʔυόϥϯα
    L2SW
    L/B
    Server B
    Server A Server C

    View full-size slide


  15. εςʔτϨεɾϩʔυόϥϯε
    L2SW
    Server B
    Server A Server C
    ECMP (hash(ip:port))

    View full-size slide


  16. εςʔτϨεɾϩʔυόϥϯε
    L2SW
    Server B
    Server A Server C
    ECMP (hash(ip:port))
    IUUQTXXXGBTUMZDPNCMPHCVJMEJOHBOETDBMJOHGBTUMZOFUXPSLQBSUCBMBODJOHSFRVFTUT

    View full-size slide


  17. • ཁ݅
    – Ϋϥελ಺Ͱ࠷௿̎ϊʔυ͕ॻࠐ
    – ฏۉXSJUFTTFDɾTFSWFS
    • )551Ϩεϙϯεͷ͕Ωϟογϡߋ৽ͱԾఆ
    • ॻ͖ࠐΈ୯Ґʹ)551Ϩεϙϯε ൺֱతେ

    • 44%ͷ໰୊
    – ॻࠐϨΠςϯγ
    – ΢ΣΞϨϕϦϯά
    44%Ωϟογϡ

    View full-size slide


  18. • ղܾࡦ
    – ಠࣗϑΝΠϧγεςϜ
    – Ұൠతͳ GTΑΓ؇͍Ұ؏ੑཁ݅
    – 44%ͷಛੑʢྫϒϩοΫαΠζʣʹ࠷దԽ
    44%Ωϟογϡ

    View full-size slide


  19. • ϧʔςΟϯά
    • 5$1ͷνϡʔχϯά
    – ᫔᫓੍ޚɺ*/*5$8/%
    • ܧଓతͳϞχλϦϯάͱϑΟʔυόοΫ
    – ੈք֤஍ʹϞχλϦϯάϊʔυ
    ωοτϫʔΫͷ؂ࢹͱνϡʔχϯά

    View full-size slide


  20. ߴ଎ͳ)551࣮૷

    View full-size slide


  21. • 'BTUMZͷ101ͷಛ௃
    – εʔύʔϚʔέοτϞσϧʢߴώοτ཰ʣ
    – ΧελϜιϑτ΢ΣΞʹΑΓ
    – ߴՁͳઐ༻ϋʔυ΢ΣΞΛ༻͍ͣʹ
    – ߴՄ༻ੑͱߴޮ཰ੑΛ࣮ݱ
    • ϧʔςΟϯά
    • ϩʔυόϥϯε
    • ϑΝΠϧγεςϜ
    • ܧଓతͳ؂ࢹ
    – 5$1 5-4 )551Ϩϕϧͷνϡʔχϯά
    ·ͱΊ

    View full-size slide


  22. શੈքతͳ෼ࢄ,74

    View full-size slide


  23. • 7BSOJTI$POUSPM-BOHVBHF 7$-

    – )551ϦΫΤετͷॲཧΛΧελϚΠζ͢Δ
    ϓϩάϥϛϯάݴޠ
    sub vcl_miss {
    if (req.http.User-Agent ~ "Googlebot") {
    set req.backend = F_special_google_backend;
    }
    return(fetch);
    }
    ϓϩάϥϜՄೳͳ$%/

    View full-size slide


  24. • ϦΫΤετͷϧʔςΟϯά
    • ϦΫΤετͷॻ׵
    • Ϩεϙϯεϔομͷॻ׵
    • ϦΫΤετͷ࠶ૹʢճ਺੍ݶ͋Γʣ
    • ʜ
    7$-ͰͰ͖Δ͜ͱ

    View full-size slide


  25. • 63-Λࢦఆͯ͠ͷύʔδ
    • αϩήʔτɾΩʔΛࢦఆͯ͠ͷύʔδ
    – ಛఆͷΩʔ͕͍ͭͨΩϟογϡΛ·ͱΊͯ
    ύʔδ
    HTTP/1.1 200 OK
    Content-Type: text/html
    Content-Length: 1234
    Surrogate-Key: mainpage template-a

    Πϯελϯτɾύʔδ

    View full-size slide


  26. • ϓϩάϥϜՄೳͳ$%/
    • 63-Ͱࢀর͠ɺΩϟογϡ
    – ϦΫΤετॻ׵ʹΑΓ೚ҙͷΩʔͰࢀরՄೳ
    • ೚ҙͷλΠϛϯάɾཻ౓Ͱύʔδ
    શੈքతͳ෼ࢄ,74

    View full-size slide


  27. 4IJFMEJOH
    Origin
    NRT POP
    LHR POP
    SFO POP ITM POP

    View full-size slide


  28. • ٕज़ཁૉ
    – େ༰ྔͷΩϟογϡ
    – Πϯελϯτɾύʔδ
    – 4IJFMEJOH
    ۃΊͯߴ͍Ωϟογϡ཰Λ࣮ݱՄೳ

    View full-size slide


  29. • 8FC"QQMJDBUJPO'JSFXBMM
    – σϑΥϧτʴΧελϚΠζՄೳͳϧʔϧ
    • %%P4
    – $%/͸ωοτϫʔΫ༰ྔ͕େ͖͍
    • খ͞ͳ%%P4͸໰୊ʹͳΒͳ͍
    – %%P4ʹରԠ͢Δઐ༻ͷ4JOL
    ߈ܸରࡦ

    View full-size slide


  30. • ը૾ͷαΠζɺ඼࣭ɺѹॖํࣜΛΫϥΠ
    Ξϯτຖʹ࠷దԽ
    ը૾࠷దԽ

    View full-size slide








  31. ...
    ...…
    ...…
    ...…
    &EHF4JEF*ODMVEFT

    View full-size slide


  32. ϚΠΫϩαʔϏε߹੒ ೝূ
    IUUQTTQFBLFSEFDLDPNSZZTENJDSPTFSWJDFTPOGBTUMZ

    View full-size slide


  33. ΠϯλʔωοτͷਐԽͱ$%/

    View full-size slide


  34. • 5$1
    • ΢Σϒ஀ੜ
    • )551
    • 5-4
    • )551
    • 5-4 ࣮࣭ 5-4

    • 26*$ ࣮࣭ 5$1

    Πϯλʔωοτϓϩτίϧͷྺ࢙

    View full-size slide


  35. • ϓϩτίϧ্ͷ੍ݶ͕ϘτϧωοΫʹ
    • εϚʔτϑΥϯͷීٴ
    • $%/ͷຄڵ
    – ϓϩτίϧਐԽʹ͸ΫϥΠΞϯτ։ൃऀͱ
    αʔό։ൃऀͷ߹ҙ͕ඞཁ
    – αʔό։ൃʹ౤ࢿ͢Δ૊৫ʹ$%/
    • εϊʔσϯࣄ݅

    ͳͥࠓͳͷ͔ r ͍͔ͭ͘ͷཧ༝

    View full-size slide


  36. • શͯͷ௨৴Λ҉߸Խ
    – ϓϥΠόγʔอޢͱߗ௚Խରࡦͷཱ྆
    • ΑΓਝ଎ͳηοτΞοϓ
    – 355 1VTI &BSMZ)JOUT
    • ωοτϫʔΫΛ·͍ͨͰ΋్੾Εͳ͍௨৴
    – ઀ଓͷϋϯυΦʔόʔͱϚϧνύεରԠ
    • ྼѱͳ؀ڥԼͰ΋೪Γڧ͘
    – ϔουΦϒϥΠϯϒϩοΩϯάͷղܾɺલํ
    Τϥʔగਖ਼
    ϓϩτίϧਐԽͷํ޲ੑ

    View full-size slide


  37. • %/4PWFS)5514
    – %/4ΫΤϦͷԠ౴΋$%/͔ΒɺηΩϡΞʹ
    • &BSMZ)JOUT$BDIF%JHFTUTGPS)
    – ΦϦδϯͷॲཧதʹ$%/͔ΒΞηοτΛ഑৴
    • 4FSWFS5JNJOH
    – ϦΫΤετड৴ɺϨεϙϯεੜ੒ɺ഑৴λΠϛϯάΛ+4Ͱऔಘ
    • 4FDPOEBSZ$FSUJGJDBUFT
    – ̍ຊͷ5-4઀ଓͰෳ਺ͷূ໌ॻΛ࢖༻
    • 4IPSU5FSN$FSUT%FMFHBUFE$SFET
    – ൿີݤ࿙ӮͷӨڹΛ੍ݶ ݕӾରࡦؚΉ

    • 7BSJBOUT
    – 7BSZͷΩϟογϡരൃ໰୊Λղܾ
    $%/ʹಛʹؔ܎ͷ͋Δϓϩτίϧ֦ு

    View full-size slide


  38. 26*$
    IUUQTXXXJFUGPSHQSPDFFEJOHTTMJEFTTMJEFTRVJDQEG

    View full-size slide


  39. • ʙ355Ͱͷ઀ଓཱ֬
    • ϔουΦϒϥΠϯϒϩοΩϯάͷղܾ
    • ωοτϫʔΫΛ·͍ͨͰ΋్੾Εͳ͍
    • ΑΓྑ͍ϓϥΠόγʔอޢ
    • ਐԽΛଓ͚Δ௨৴ϓϩτίϧ
    – Χʔωϧ΍ϧʔλͷӨڹΛഉআ
    • ΞοϓσʔτͰ͖ͳ͍σόΠε͸௕ظతʹݟͯअ
    ຐʹͳΔ
    26*$ͷ໨ඪ

    View full-size slide


  40. • τϥϯεϙʔτͷઃܭ͸ݻ·Γͭͭ͋Δ
    – ࢒݅
    • ϋϯυγΣΠΫઃܭͷϦϑΝΫλ
    • ύέοτ൪߸҉߸Խ
    • )551ʗϔομѹॖͷৄࡉ͸͜Ε͔Β
    26*$ඪ४Խͷਐ௙ঢ়گ

    View full-size slide


  41. 26*$r ૬ޓ઀ଓࢼݧ

    View full-size slide


  42. • .BSL/PUUJOHIBN
    – )551 26*$8(ٞ௕ *"#ϝϯόʔ
    • +BOB*ZFOHBS
    – *$$3(ٞ௕ 26*$ඪ४ͷΤσΟλ
    • +PFM+BFHHMJ
    – /FUNPE 8(ٞ௕
    • .FMJOEB4IPSF
    – 5SBOT8( %*/3(ٞ௕ *"#ϝϯόʔ
    'BTUMZͱϓϩτίϧඪ४Խ

    View full-size slide


  43. • ΑΓ҆͘ɺΑΓ଎͘ίϯςϯπΛ഑৴
    – ߴ͍Ωϟογϡώοτ཰Λ࣮ݱ
    • શੈքతͳ෼ࢄ,74
    – ϓϩάϥϚϒϧͳ$%/
    – ॊೈͳ੍ޚ
    • &EHF$MPVE
    – ͞Βʹ༷ʑͳػೳΛఏڙ
    • ϓϩτίϧͷਐԽΛଅਐ
    – )551 5-4 26*$
    $%/ͱͯ͠ͷϛογϣϯ

    View full-size slide