Slide 1

Slide 1 text

͘͞ΒΠϯλʔωοτ גࣜձࣾ (C) Copyright 1996-2019 SAKURA Internet Inc ͘͞ΒΠϯλʔωοτ ݚڀॴ ΤοδίϯϐϡʔςΟϯάʹ޲͚ͨ ෼ࢄΩϟογϡٕज़ͷௐࠪ 2019/04/13 ݚڀһ ௶಺ ༎थ ୈ4ճWebSystemArchitectureݚڀձ@ژ౎ @yuuk1t / id:y_uuki

Slide 2

Slide 2 text

2 1. എܠͱ໨త 2. ΦϒδΣΫτΩϟογϡ 3. ΫΤϦϦβϧτΩϟογϡ 4. ·ͱΊ ໨࣍

Slide 3

Slide 3 text

1. എܠͱ໨త

Slide 4

Slide 4 text

4 WebαʔϏεͷϢʔβʔͷମݧͷ޲্ ɾԠ౴଎౓ͷվળʹΑΓɼϢʔβʔͷମݧ͕޲্͢Δ ɾ40%Ҏ্ͷWebαʔϏεͷϢʔβʔ͸ϖʔδͷಡΈࠐΈΛ3ඵҎ্଴ ͯͳ͍ͱ͍͏ௐࠪ݁Ռ͕͋Δ[2] ɾಡΈࠐΈ஗ԆͷཁҼ ɾ(1) Ϋϥ΢υͷσʔληϯλʔ಺Ͱͷॲཧ஗Ԇ ɾ(2) ΤϯυϢʔβʔͱσʔληϯλʔؒͷωοτϫʔΫసૹ஗Ԇ ɾ(3) ϒϥ΢β্Ͱͷίϯςϯπදࣔ஗Ԇ ɾ(2)ͷ஗ԆΛ௿ݮ͢Δʹ͸ΤϯυϢʔβʔͷۙ๣Ͱॲཧ͢Δඞཁ͕͋Δ [2]: Forrester Consulting, "eCommerce Web Site Performance Today: An Updated Look At Consumer Reaction To A Poor Online Shopping Experience", 2019.

Slide 5

Slide 5 text

5 CDNʹΑΔ੩తϑΝΠϧͷԠ౴ੑೳ޲্ ɾCDN͸ɼΞΫηεݩ͔Β࠷΋͍ۙαʔόΛબ୒͠ɼϑΝΠϧΛ഑৴ ͢Δ͜ͱʹΑΓɼωοτϫʔΫ஗ԆΛ௿ݮ͢Δ ɾ௨ৗɼCDNͷαʔό্ʹ഑ஔ͢Δίϯςϯπ͸Ωϟογϡͱͯ͠ར ༻͞ΕɼΦϦδϯͷίϯςϯπ͸σʔληϯλʔ্ʹ͋Δ ɾϑΝΠϧͰ͸ͳ͘ɼॲཧΛ഑ஔ͢Δ͜ͱʹΑΓಈతίϯςϯπΛߴ ଎ʹ഑৴͍ͨ͠

Slide 6

Slide 6 text

6 CDNʹΑΔಈతίϯςϯπ഑৴ ɾFastlyͳͲ͕ΩϟογϡͷແޮԽॲཧΛߴ଎Խ ɾෆཁͳΩϟογϡແޮԽΛ͠ͳ͍ͨΊʹɼίϯςϯπͷߏ੒෦Ґʹ λάΛ෇༩͢Δ͜ͱʹΑΓɼಈతʹมԽ͢Δ෦ҐͷΈΛແޮԽՄೳ

Slide 7

Slide 7 text

7 CDN Edge Worker ɾCDNͷΤοδαʔό্Ͱཁٻʹରͯ͠೚ҙͷॲཧΛ࣮ߦ͍ͨ͠ ɾϑΝΠϧͰ͸ͳ͘ɼΞϓϦέʔγϣϯΛϢʔβʔͷۙ๣ʹ഑ஔ͢Δ CDN Edge Workerͱݺ͹ΕΔαʔϏε͕ొ৔͍ͯ͠Δ ɾAWS Lambda@Edge[3]ɼCloudflare Workers[4]ɼfly.io[5]ͳͲ ɾϓϩάϥϛϯάݴޠॲཧܥͷ੍໿͸͋Δ

Slide 8

Slide 8 text

8 ՝୊ͱݚڀ໨త ɾCDN؀ڥͰ͸ɼΤοδؒͱΤοδ-Ϋϥ΢υؒͷσʔλҰ؏ੑ͕ऑ ͘ɼΞϓϦέʔγϣϯϩδοΫΛΤοδ޲͚ʹ࠷దԽ͠ͳ͚Ε͹ͳ Βͳ͍ͱ͍͏՝୊͕͋Δ ɾσʔλҰ؏ੑΛڧΊɺΞϓϦέʔγϣϯΛมߋͤͣʹɺΤοδΛ׆ ༻͠Ԡ౴ੑೳΛ޲্Ͱ͖ͳ͍͔ʁ ɾҎ্ͷ؍఺ͰɼωοτϫʔΫ஗ԆΛ௿ݮ͢ΔͨΊʹɼΤοδ্Ͱί ϯςϯπੜ੒΍഑৴ʹඞཁͳσʔλͷΩϟογϡΛ΋ͭͨΊͷ෼ࢄ Ωϟογϡٕज़Λௐࠪ͢Δ

Slide 9

Slide 9 text

9 ΤοδίϯϐϡʔςΟϯά ɾIoTɼεϚʔτγςΟɼԾ૝ݱ࣮ͳͲਓʑͷ਎ ۙʹίϯϐϡʔςΟϯά͕ਁಁ ɾਓΛ଴ͨͤͣʹԠ౴͠ͳ͚Ε͹ͳΒͳ͍ ɾΫϥ΢υίϯϐϡʔςΟϯάͰ͸ɼωοτ ϫʔΫϨΠςϯγ͕େ͖͘ߴ଎ʹԠ౴Ͱ͖ͳ͍ ɾΤϯυϢʔβʔͷۙ๣ʢΤοδʣʹαʔόΛ഑ ஔͯ͠ɼཁٻΛॲཧ Cloud Edge Edge Edge Edge ωοτϫʔΫϨΠςϯγ࠷খԽ

Slide 10

Slide 10 text

10 ຊݚڀʹ͓͚ΔΤοδͷείʔϓ ɾখɾதن໛ͳσʔληϯλʔɼϥοΫ୯Ґͷσʔληϯλʔ ɾΫϥ΢υͰల։͢ΔIaaS૬౰͔ͦΕҎ্ͷந৅౓ͷج൫͕ಈ࡞ ɾج൫͕ఏڙ͢ΔαʔϏεͷൣғ಺ͰWebαʔϏε։ൃऀ͕؅ཧՄೳ ɾݱࡏɼఏҊɾ࣮ݱ͞Ε͍ͯΔ΋ͷͱͯ͠ɼCloudletɼMicro DataCenter·ͨ͸CDN Edge WorkerͳͲ͕͋Δ

Slide 11

Slide 11 text

2. ΦϒδΣΫτΩϟογϡ

Slide 12

Slide 12 text

12 ΦϒδΣΫτΩϟογϡ ɾΞϓϦέʔγϣϯ͕೚ҙͷΦϒδΣΫτΛΩϟογϡ͢ΔͨΊͷػ ߏ ɾωοτϫʔΫܕͷ෼ࢄΩϟογϡ ɾΞϓϦέʔγϣϯϓϩηεͱಉҰͷϝϞϦۭؒʹΩϟογϡσʔλ Λอ࣋͢Δ૊ΈࠐΈܕͷ෼ࢄΩϟογϡ

Slide 13

Slide 13 text

13 ωοτϫʔΫܕͷ෼ࢄΩϟογϡ ɾΞϓϦέʔγϣϯϓϩηε͕ωοτϫʔΫ௨ ৴ͯ͠ར༻͢Δ ɾෳ਺ͷΩϟογϡϊʔυ΁ෛՙ෼ࢄ͢ΔͨΊ ʹɼϋογϡ๏Λར༻͢Δ ɾΦϒδΣΫτͷΩʔͱ෼ࢄઌͷΩϟογϡ ϊʔυΛඥ͚ͮ͠ɼΦϒδΣΫτ୯ҐͰ෼ࢄ͞ ͤͯΩϟογϡϊʔυ΁σʔλΛ഑ஔ͢Δ ɾMemcached΍Redis͕ར༻͞ΕΔ ɾΩϟογϡϊʔυಉ࢜͸ڠௐ͍ͯ͠ΔΘ͚Ͱ ͸ͳ͍ Cache Node Cache Node Cache Node App Node

Slide 14

Slide 14 text

App Node 14 ૊ΈࠐΈܕͷ෼ࢄΩϟογϡ(Groupcache) ɾෳ਺ͷϊʔυ͕ڠௐͯ͠ҰͭͷΩϟογϡۭؒ Λ࡞੒Մೳ ɾσʔλΛੵۃతʹڞ༗͠ͳ͍ ɾϐΞϊʔυ͸ίϯγεςϯτϋογϡ๏ʹΑΓ બ୒͞ΕΔ ɾϩʔΧϧͰͷΩϟογϡϛε࣌ʹ͢΂ͯͷϐ ΞʹϑΥʔϧόοΫ͠ͳͯ͘Α͍ ɾߋ৽ͱ࡟আΛαϙʔτ͓ͯ͠ΒͣɼLRUʹΑΓ Ωϟογϡ͕ഁغ͞Εͳ͍͔͗Γɼීวͷσʔ λΛ֨ೲ͢Δ Cache App Node Cache App Node Cache ᶃ ϩʔΧϧΩϟογϡऔಘ ᶅϩʔΧϧ Ωϟογϡ ʹ֬཰తʹ ॻ͖ࠐΈ ᶄϐΞϊʔυ΁ϑΥʔϧόοΫ ᶄ ᶃ

Slide 15

Slide 15 text

15 ΤοδίϯϐϡʔςΟϯά΁ͷల։ ɾ௿ϨΠςϯγͰΩϟογϡΛऔಘ͢ΔͨΊʹɼۙྡͷΤοδʹ഑ஔ͞ ΕͨΩϟογϡϊʔυ͔ΒσʔλऔಘΛ׬͍݁ͨ͠ ɾΤοδ܈ΛΤϦΞʹ۠੾ΓɼΤϦΞ͝ͱʹΩϟογϡΫϥελΛ༻ҙ ͢Δ ɾԾʹΩϟογϡͷࢀরύλʔϯ͕ಉ͡ΤϦΞʹภΔ৔߹ɼͳΜΒ͔ͷ ํ๏Ͱڑ཭͕͍ۙΤοδ܈Λೝࣝ͢Δ͜ͱʹΑΓɼۙ๣Τοδ಺Ͱ׬ ݁ͯ͠ΩϟογϡΛಡΈॻ͖Մೳ

Slide 16

Slide 16 text

3. ΫΤϦϦβϧτΩϟογϡ

Slide 17

Slide 17 text

17 ΫΤϦϦβϧτΩϟογϡ ɾσʔλϕʔεϛυϧ΢ΣΞͷ૚ͰɼΫΤϦ݁ՌΛΩϟογϡ͢Δ࢓ ૊Έ ɾDBαʔόܕΫΤϦΩϟογϡ ɾϓϩΩγܕΫΤϦΩϟογϡ ɾProxySQL (ελϯυΞϩʔϯ) ɾDBProxy (෼ࢄڠௐ) ɾFerdinand (෼ࢄڠௐ)

Slide 18

Slide 18 text

18 DBαʔόܕΫΤϦΩϟογϡ ɾσʔλϕʔεαʔόࣗମ͕ΩϟογϡػߏΛ΋ͭ ɾ௥Ճͷιϑτ΢ΣΞͳ͠ʹར༻Մೳ ɾMySQLͷΫΤϦΩϟογϡ͸͜Εʹ֘౰ ɾMySQL͸ɺςʔϒϧʹߋ৽͕͋Ε͹ɼ౰֘ςʔϒϧͷมߋ͕݁Ռʹ Өڹ͢ΔΫΤϦͷΩϟογϡΛഁغ͢ΔͨΊɺςʔϒϧͱΩϟο γϡؒͰҰ؏ੑ͸อͨΕΔ ɾ→ Ωϟογϡώοτ཰͕௿͍ ɾΩϟογϡͦͷ΋ͷΛϢʔβʔͷۙ๣ʹ഑ஔͰ͖ͳ͍ͨΊɼωοτ ϫʔΫ஗Ԇͷ௿ݮ͸Ͱ͖ͳ͍

Slide 19

Slide 19 text

19 ϓϩΩγܕΫΤϦΩϟογϡ: ProxySQL ɾMySQLϓϩτίϧΛղऍ͢Δಠཱϓϩηεͱͯ͠ىಈ͢ΔϓϩΩγ ɾMySQLαʔόΑΓ΋ΑΓϑϩϯτΤϯυʹ͍ۙҐஔʹ഑ஔՄೳ ɾΞϓϦέʔγϣϯαʔόͱಉҰͷϗετ্ʹ഑ஔ͢Δ͜ͱʹΑΓɼ ΞϓϦέʔγϣϯαʔόͱMySQLαʔόؒͷRTTΛ࡟ݮ App Node Proxy SQL App Node Proxy SQL MySQL Server ɾTTL(Time to Live)Λར༻ͯ͠ΩϟογϡΛແ ޮԽ͢ΔͨΊɼΞϓϦέʔγϣϯʹݹ͘ͳͬ ͨσʔλΛฦ͢Մೳੑ͕͋Δ ɾ෼ࢄڠௐͯ͠ಈ࡞͢ΔΘ͚Ͱ͸ͳ͍

Slide 20

Slide 20 text

20 ϓϩΩγܕΫΤϦΩϟογϡ: DBProxy ɾΤοδ্ʹ഑ஔ͞Ε֤ͨΞϓϦέʔγϣϯαʔό͕தԝͷσʔλ ϕʔεαʔόʹର͢ΔΫΤϦ݁ՌΛΩϟογϡ ɾΫΤϦ݁Ռ͕ଞͷΫΤϦʹΑΓΩϟογϡ͞ΕͨσʔλʹΑΔߏங Ͱ͖ΔͷͰ͋Ε͹ɼະΩϟογϡͷΫΤϦͷ݁ՌΛฦ͢ App Node DB Proxy App Node DB Proxy DB Server ɾߋ৽Λߪಡ͠ετϦʔϜͰҰ؏ੑΛอূ ɾதԝूݖతʹҰ؏ੑΛ؅ཧ͢Δ͜ͱʹΑ Γɼ֤Ωϟογϡ͸தԝσʔλϕʔεʹର͠ ͯίώʔϨϯτ ɾΫΤϦΩϟογϡΛར༻͢Δෳ਺ͷεςʔ τϝϯτΛؚΉτϥϯβΫγϣϯʹ͸ରԠͰ ͖ͳ͍ Subscribe Update

Slide 21

Slide 21 text

21 ϓϩΩγܕΫΤϦΩϟογϡ: Ferdinand ɾಈతίϯςϯπ഑৴ͷͨΊͷڠௐಈ࡞͢ΔΫΤϦΩϟογϡϓϩΩγ ɾτϐοΫϕʔεͷpub/subϞσϧʹΑΓɼΩϟογϡͷҰ؏ੑΛҡ࣋ ɾҰ؏ੑʹ͍ͭͯ͸DBProxyͱಉ༷ ɾ෼ࢄϋογϡςʔϒϧΛར༻͢ ΔͨΊɼ֤ϓϩΩγ͕ಉ͡σʔ λΛڞ༗͍ͯ͠ͳ͍ ɾΩϟογϡϛεͯ͠΋ଞͷϓϩ Ωγϊʔυ΁ϑΥϫʔυ ɾγϯϓϧͳΩϟογϡͱൺֱ ͠ɺ3ഒͷੑೳ޲্ ग़య: [9]: C Garrod, et al., "Scalable query result caching for web applications", VLDB Endowment, vol.1, no.1, pp.550-561, 2008

Slide 22

Slide 22 text

22 ϓϩΩγܕΫΤϦΩϟογϡ: Ferdinand ɾϓϩΩγαʔόؒͱதԝσʔλ ϕʔεؒͷ஗Ԇͱεϧʔϓοτͷ ؔ܎ ɾ஗Ԇ50msఔ౓ͰFerdinandͷε ϧʔϓοτ͕SimpleCacheΑΓ௿ ɾ(౦ژ-ੴङؒͰ20msະຬఔ౓) ɾFerdinandͷϩʔΧϧͱϚελʔ Ωϟογϡͷ྆ํͷΩϟογϡϛ ε࣌ͷωοτϫʔΫϗοϓͷͨΊ

Slide 23

Slide 23 text

4. ·ͱΊ

Slide 24

Slide 24 text

24 ·ͱΊ ɾWebαʔϏεͷϢʔβʔମݧ޲্ͷͨΊʹΤϯυϢʔβʔͷۙ๣Ͱ ཁٻΛॲཧ͍ͨ͠ ɾCDNɼCDN Edge Worker͸ΤοδؒͰσʔλΛڞ༗͢Δͱ͖ʹҰ ؏ੑͷ՝୊Λ΋ͭ ɾಡΈग़͠ੑೳ޲্ͷͨΊͷ෼ࢄΩϟογϡٕज़Λௐࠪ ɾΩϟογϡΛڞ༗ͤͣɼίϯγεςϯτϋογϡ๏΍Groupcacheͷ ڠௐΩϟογϯάɼ෼ࢄϋογϡςʔϒϧΛར༻͢Δ͜ͱ͕͋Δ ɾΤοδίϯϐϡʔςΟϯάʹ͓͍ͯ΋ɼ͢΂ͯͷΤοδͰΩϟο γϡΛڞ༗ͤͣʹɼΩϟογϡ͕ঃʑʹඞཁͱ͞ΕΔ৔ॴʹҠಈ͢ ΔΑ͏ͳ࢓૊ΈΛߟ͑ΒΕͳ͍͔

Slide 25

Slide 25 text

25 ࠓޙͷ՝୊ ɾP2P΍Content-Centric Network(CCN)ͳͲͷΫϥ΢υͰ͸ͳ͘ɼΤ ϯυσόΠε΍ωοτϫʔΫϧʔλʔͰॲཧΛ͢ΔΑ͏ͳख๏ͷௐ ࠪ