Slide 1

Slide 1 text

WebΞϓϦέʔγϣϯͷ Ωϟογϡઓུͱ ͦͷύλʔϯ @moznion

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

໔੹ ੈͷத৭ʑͳέʔε͕͋Γ·͔͢Β શͯΛΧόʔ͢Δ಺༰͸ແཧͰͨ͠ ͜ͷ಺༰͸҃ΔҰྫͩͱࢥͬͯ ϦϥοΫεͯ͠ோΊ͍ͯͩ͘͞

Slide 4

Slide 4 text

@moznion Web application server side engineer Twitter: @moznion GitHub: moznion

Slide 5

Slide 5 text

Ωϟογϡ

Slide 6

Slide 6 text

ࠓճ࿩͢͜ͱ - WebΞϓϦέʔγϣϯʹ͓͚ΔΩϟογϡʹ͍ͭͯ - HTTPϨΠϠͰͷΩϟογϡ - ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ - ΩϟογϡΛ΍ΊΑ͏

Slide 7

Slide 7 text

લఏ: ߴ଎ͳ (Web) ΞϓϦέʔγϣϯΛ ߏஙɾӡ༻͍ͯ͘͠ඞཁ͕͋Δ

Slide 8

Slide 8 text

Ωϟογϡͱ͸ͳʹ͔ʁ

Slide 9

Slide 9 text

Ωϟογϡʁ ʮΩϟογϡ: ෺ΛӅͨ͠Γ֨ೲͨ͠Γ͓ͯ͘͠ͷʹ҆શͳ৔ॴʯ ― Webster ৽ੈքถޠࣙయɼΧϨοδ൛ ୈ3൛ ʮΩϟογϡͱ͸ௐ΂Δඞཁͷ͋Δ΋ͷΛஔ͍͓ͯ҆͘શͳ৔ॴͷ ͜ͱͰ͋ΔɽΩϟογϡͱ͍͏༻ޠ͸ɼ࠷ॳͷ঎༻ίϯϐϡʔλʹ ͓͍ͯɼϓϩηοαͱओهԱͱͷؒʹૠೖ͞ΕͨهԱ֊૚ϨϕϧΛ දͨ͢Ίʹ࢖༻͞Εͨɽ(தུ) ͜ͷ༻ޠ͸ࠓ೔Ͱ͸ࢀরͷہॴੑΛ ར༻͢ΔΑ͏ʹ؅ཧ͞Εͨ೚ҙͷهԱΛࢦͯ͠΋࢖༻͞ΕΔʯ ― σΠϏου A ύλʔιϯ, δϣϯ ̡ ϔωγʔ ஶ, ੒ా ޫজ ༁ ίϯϐϡʔλͷߏ੒ͱઃܭɼୈ5൛ [Լ] ❞ ❞

Slide 10

Slide 10 text

ͳΔ΄Ͳ…

Slide 11

Slide 11 text

લఏ: ߴ଎ͳ (Web) ΞϓϦέʔγϣϯΛ ߏஙɾӡ༻͍ͯ͘͠ඞཁ͕͋Δ

Slide 12

Slide 12 text

લఏ: ߴ଎ͳ (Web) ΞϓϦέʔγϣϯΛ ߏஙɾӡ༻͍ͯ͘͠ඞཁ͕͋Δ

Slide 13

Slide 13 text

Ωϟογϡʁ ʮΩϟογϡ: ෺ΛӅͨ͠Γ֨ೲͨ͠Γ͓ͯ͘͠ͷʹ҆શͳ৔ॴʯ ― Webster ৽ੈքถޠࣙయɼΧϨοδ൛ ୈ3൛ ʮΩϟογϡͱ͸ௐ΂Δඞཁͷ͋Δ΋ͷΛஔ͍͓ͯ҆͘શͳ৔ॴͷ ͜ͱͰ͋ΔɽΩϟογϡͱ͍͏༻ޠ͸ɼ࠷ॳͷ঎༻ίϯϐϡʔλʹ ͓͍ͯɼϓϩηοαͱओهԱͱͷؒʹૠೖ͞ΕͨهԱ֊૚ϨϕϧΛ දͨ͢Ίʹ࢖༻͞Εͨɽ(தུ) ͜ͷ༻ޠ͸ࠓ೔Ͱ͸ࢀরͷہॴੑΛ ར༻͢ΔΑ͏ʹ؅ཧ͞Εͨ೚ҙͷهԱΛࢦͯ͠΋࢖༻͞ΕΔʯ ― σΠϏου A ύλʔιϯ, δϣϯ ̡ ϔωγʔ ஶ, ੒ా ޫজ ༁ ίϯϐϡʔλͷߏ੒ͱઃܭɼୈ5൛ [Լ] ❞ ❞

Slide 14

Slide 14 text

Ωϟογϡʁ ʮΩϟογϡ: ෺ΛӅͨ͠Γ֨ೲͨ͠Γ͓ͯ͘͠ͷʹ҆શͳ৔ॴʯ ― Webster ৽ੈքถޠࣙయɼΧϨοδ൛ ୈ3൛ ʮΩϟογϡͱ͸ௐ΂Δඞཁͷ͋Δ΋ͷΛஔ͍͓ͯ҆͘શͳ৔ॴͷ ͜ͱͰ͋ΔɽΩϟογϡͱ͍͏༻ޠ͸ɼ࠷ॳͷ঎༻ίϯϐϡʔλʹ ͓͍ͯɼϓϩηοαͱओهԱͱͷؒʹૠೖ͞ΕͨهԱ֊૚ϨϕϧΛ දͨ͢Ίʹ࢖༻͞Εͨɽ(தུ) ͜ͷ༻ޠ͸ࠓ೔Ͱ͸ࢀরͷہॴੑΛ ར༻͢ΔΑ͏ʹ؅ཧ͞Εͨ೚ҙͷهԱΛࢦͯ͠΋࢖༻͞ΕΔʯ ― σΠϏου A ύλʔιϯ, δϣϯ ̡ ϔωγʔ ஶ, ੒ా ޫজ ༁ ίϯϐϡʔλͷߏ੒ͱઃܭɼୈ5൛ [Լ] ❞ ❞ جຊతͳ֓೦ͱͯ͠͸ͦͷ௨Γ Ͱ΋͜Εϓϩηοαͷ࿩ͩʂ

Slide 15

Slide 15 text

ࠓճ࿩͞ͳ͍͜ͱ - WebΞϓϦέʔγϣϯҎ֎ͷΩϟογϡʹ͍ͭͯ - e.g - ϓϩηοαͷΩϟογϡ - DNSΩϟογϡʹ͍ͭͯ΋ࠓճ͸͠·ͤΜ - ଞʹ΋৭ʑͳ࿩Λ͠·ͤΜ

Slide 16

Slide 16 text

WebΞϓϦέʔγϣϯʹ͓͚Δ Ωϟογϡͱ͸ͳʹ͔ʁ

Slide 17

Slide 17 text

WebΞϓϦέʔγϣϯʹ͓͚ΔΩϟογϡʁ αʔό͕ฦ͢΂͖ίϯςϯπʹ͍ͭͯ…… - 1࣍ετϨʔδΑΓߴ଎ͳετϨʔδʹ
 ഑ஔ͓͍͔ͯͯͦ͜͠Βฦ͢ - ΋͘͠͸ฦ͞ͳ͍

Slide 18

Slide 18 text

WebΞϓϦέʔγϣϯʹ͓͚ΔΩϟογϡʁ ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ ߴ଎ͳετϨʔδܦ༝Ͱฦ͢ํ HTTPϨΠϠͰͷΩϟογϡ ϨεϙϯεΛฦ͞ͳ͍ํ

Slide 19

Slide 19 text

WebΞϓϦέʔγϣϯʹ͓͚ΔΩϟογϡʁ ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ ߴ଎ͳετϨʔδܦ༝Ͱฦ͢ํ HTTPϨΠϠͰͷΩϟογϡ ϨεϙϯεΛฦ͞ͳ͍ํ

Slide 20

Slide 20 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage Heavy Component OR

Slide 21

Slide 21 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage i ii iii iv i. ϦΫΤετ ii. Ұ࣍ετϨʔδ໰͍߹Θͤ iii. ݁ՌΛฦ͢ iv. Ϩεϙϯε

Slide 22

Slide 22 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage i ii iii iv i. ϦΫΤετ ii. Ұ࣍ετϨʔδ໰͍߹Θͤ iii. ݁ՌΛฦ͢ iv. Ϩεϙϯε ͕͜͜ωοΫ ͷ৔߹

Slide 23

Slide 23 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage ii iii Cache Storage

Slide 24

Slide 24 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage i ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. ݁ՌΛฦ͢ iv. Ϩεϙϯε Cache Storage ii iii

Slide 25

Slide 25 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage i ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. ݁ՌΛฦ͢ iv. Ϩεϙϯε Cache Storage ii iii Ұ࣍ετϨʔδΑΓ Ωϟγϡ͕ߴ଎ͳΒ ૣ͘ฦͤΔ

Slide 26

Slide 26 text

ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ Server Client Primary Storage ii iii Ұ࣍ετϨʔδͱ ΩϟογϡετϨʔδ͸ ͳΜΒ͔಺༰ͷ੔߹Λ औΔඞཁ͕͋Δ Cache Storage

Slide 27

Slide 27 text

WebΞϓϦέʔγϣϯʹ͓͚ΔΩϟογϡʁ ΞϓϦέʔγϣϯϨΠϠͰͷΩϟογϡ ߴ଎ͳετϨʔδܦ༝Ͱฦ͢ํ HTTPϨΠϠͰͷΩϟογϡ ϨεϙϯεΛฦ͞ͳ͍ํ

Slide 28

Slide 28 text

HTTPϨΠϠͰͷΩϟογϡ Ωϟογϡͱ͸ɺϦιʔεͷ઱౓ʹج͍ͮͯɺҰ౓औಘͨ͠Ϧιʔ εΛΫϥΠΞϯτଆͰ࢖͍·Θ͢ํࣜͰ͢ɻ Ωϟογϡͷར఺͸ɺαʔόͱΫϥΠΞϯτؒͷ௨৴ΛݮΒ͢͜ͱ ͰωοτϫʔΫଳҬͷར༻΍ॲཧ࣌ؒΛॖখ͠ɺΑΓޮ཰తʹॲཧ Ͱ͖Δ͜ͱͰ͢ɻ ― ࢁຊ ཅฏ ஶ WebΛࢧ͑Δٕज़ - HTTPɺURIɺHTMLɺͦͯ͠REST (WEB+DB PRESS plus) ❞

Slide 29

Slide 29 text

HTTPϨΠϠͰͷΩϟογϡ Server Client contents

Slide 30

Slide 30 text

HTTPϨΠϠͰͷΩϟογϡ Server Client i ii i. ίϯςϯπ͘Εʙ ii. ͸͍Αʙ contents

Slide 31

Slide 31 text

HTTPϨΠϠͰͷΩϟογϡ Server Client i ii i. ίϯςϯπ͘Εʙ ii. ͸͍Αʙ contents ίϯςϯπ͕ωοτϫʔΫʹ৐Δ (serverͷཪଆͰ͸ߋʹॏ͍ॲཧ͕૸͍ͬͯΔ͔΋) contents

Slide 32

Slide 32 text

HTTPϨΠϠͰͷΩϟογϡ Server Client contents contents ΫϥΠΞϯτଆͰίϯςϯπΛอ࣋

Slide 33

Slide 33 text

HTTPϨΠϠͰͷΩϟογϡ Server Client contents contents i ii i. ίϯςϯπ͘Εʙ ii. ΋͏࣋ͬͯ·͢Α

Slide 34

Slide 34 text

HTTPϨΠϠͰͷΩϟογϡ Server Client contents contents i ii i. ίϯςϯπ͘Εʙ ii. ΋͏࣋ͬͯ·͢Α ίϯςϯπ͸ωοτϫʔΫʹ৐Βͳ͍ ʮ΋͏࣋ͬͯ·͢Αʯͱ͍͏৘ใ͕৐Δ

Slide 35

Slide 35 text

HTTPϨΠϠͰͷΩϟογϡ ͨͩ͠ɺݹ͍ΩϟογϡΛར༻ͯ͠͠·͍ɺ৘ใͷ৴པੑ͕Լ͕Δ Մೳੑ΋͋Γ·͢ɻ ― ࢁຊ ཅฏ ஶ WebΛࢧ͑Δٕज़ - HTTPɺURIɺHTMLɺͦͯ͠REST (WEB+DB PRESS plus) ❞

Slide 36

Slide 36 text

ࠓճ͸ओʹΞϓϦέʔγϣϯϨΠϠͷ Ωϟογϡͷ࿩͕ଟ͍Ͱ͢ (HTTPϨΠϠͷ࿩Ͱ΋ڞ௨͢Δ࿩୊͸͋Γ·͢)

Slide 37

Slide 37 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ

Slide 38

Slide 38 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)

Slide 39

Slide 39 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)

Slide 40

Slide 40 text

ϦΫΤετΛߴ଎ʹฦ٫͢Δ Server Client Cache Storage ߴ଎ʹฦ٫͢Δ͜ͱͰ ετϨε͕গͳ͘ͳΓ ϢʔβʔମݧΞοϓʂ ⚡⚡⚡

Slide 41

Slide 41 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)

Slide 42

Slide 42 text

୯Ґ࣌ؒ͋ͨΓͷॲཧ਺ͷ૿Ճ Server Client Cache Storage ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺ ૿ՃʹΑΓҰ౓ʹ ͨ͘͞ΜͷϦΫΤετΛ ͞͹͚Δ Client Client . . .

Slide 43

Slide 43 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)

Slide 44

Slide 44 text

ಛఆίϯϙʔωϯτͷෛՙܰݮ Server Client Client . . . Storage (৭ʑͳࣄ͕͋Γ) ετϨʔδʹෛՙ͕ूத͍ͯ͠Δʂ

Slide 45

Slide 45 text

ಛఆίϯϙʔωϯτͷෛՙܰݮ Server Client Client . . . Storage Cache Storage

Slide 46

Slide 46 text

ಛఆίϯϙʔωϯτͷෛՙܰݮ Server Client Client . . . Storage Cache Storage Ωϟογϡʹಀ͕ͯ͠ ΍Δ͜ͱͰ աෛՙίϯϙʔωϯτͷ ෛՙΛܰݮ͢Δ

Slide 47

Slide 47 text

ಛఆίϯϙʔωϯτͷෛՙܰݮ Server Client Client . . . Storage Cache Storage ͔͠͠Ωϟογϡίϯϙʔωϯτ͕ ૿͑Δ͜ͱͰγεςϜͱͯ͠ͷ ނোՄೳੑ͸૿Ճ͢Δʂ

Slide 48

Slide 48 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)

Slide 49

Slide 49 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ) ͭ·ΓΧω΍ʂʂʂ

Slide 50

Slide 50 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ) ͭ·ΓΧω΍ʂʂʂ

Slide 51

Slide 51 text

ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g. RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ) ͭ·ΓΧω΍ʂʂʂ Ωϟογϡ͔ʂʁ

Slide 52

Slide 52 text

͸͍

Slide 53

Slide 53 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔

Slide 54

Slide 54 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

Slide 55

Slide 55 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

Slide 56

Slide 56 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query

Slide 57

Slide 57 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query.

Slide 58

Slide 58 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query..

Slide 59

Slide 59 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query…

Slide 60

Slide 60 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query… ͜͜ͰαʔϏε͕٧·Δ (աෛՙͰDB͕μ΢ϯ͢Δ͔΋ʁ)

Slide 61

Slide 61 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Cache

Slide 62

Slide 62 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Cache Ωϟογϡʹಀ͕͢͜ͱͰ ݱ࣮తͳ࣌ؒͰฦ͢ (ෛՙ΋෼ࢄͤ͞Δ)

Slide 63

Slide 63 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

Slide 64

Slide 64 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Not slow request

Slide 65

Slide 65 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Not slow request!!!!!!

Slide 66

Slide 66 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Not slow request!!!!!! ܾͯ͠஗͍ϦΫΤετͰ͸ͳ͍͕ ϦΫΤετ͕ଟ͗ͯ͢ࡹ͖͖Εͳ͍

Slide 67

Slide 67 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache

Slide 68

Slide 68 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache ΋ͬͱߴ଎ͳετϨʔδͰ ରԠͯ͠ͳΜͱ͔͢Δ (๫ྗ)

Slide 69

Slide 69 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache

Slide 70

Slide 70 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache ͦ΋ͦ΋ωοτϫʔΫͰ ٧·ΔՄೳੑ͕͋Δ

Slide 71

Slide 71 text

ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache HTTPϨΠϠͷΩϟογϡΛ࢖ͬͯ ʮฦ͞ͳ͍ʯඞཁ͕͋Δ͔΋

Slide 72

Slide 72 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

Slide 73

Slide 73 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Request (via HTTP)

Slide 74

Slide 74 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Request (via HTTP) ֎෦αʔϏεʹ౎౓ϦΫΤετΛ ඈ͹͍ͯͯ͠͸஗͍

Slide 75

Slide 75 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Cache

Slide 76

Slide 76 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Cache ΩϟογϡΛ஥հ͢Δ͜ͱͰ ߴ଎ʹ݁ՌΛಘΔͱͱ΋ʹ ෆཁͳϦΫΤετΛ࡟ݮ͢Δ

Slide 77

Slide 77 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

Slide 78

Slide 78 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ ৭ʑͳ͜ͱ͕͋Δɼ৭ʑͳ͜ͱ͕……

Slide 79

Slide 79 text

ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ ৭ʑͳ͜ͱ͕͋Δɼ৭ʑͳ͜ͱ͕…… ͔͠͠ຊ౰ʹΩϟογϡ͕ඞཁͳͷ͔͸ख़ߟ͢΂͖ɽޙड़

Slide 80

Slide 80 text

ΩϟογϡετϨʔδ

Slide 81

Slide 81 text

ΩϟογϡετϨʔδ֓؍ - memcached - memcachedϓϩτίϧΛ஻Δ஥ؒ - Redis - BerkeleyDB - mmap (!) - ΞϓϦͷϓϩηε಺ʹ࣋ͭ - ͳͲͳͲ

Slide 82

Slide 82 text

ͦͷଞͷΩϟογϡϛυϧ΢ΣΞ

Slide 83

Slide 83 text

Ωϟογϡϛυϧ΢ΣΞ֓؍ - Squid - Varnish - ͳͲͳͲ

Slide 84

Slide 84 text

Ωϟογϡϛυϧ΢ΣΞ֓؍ - Squid - Varnish - ͳͲͳͲ HTTPϨΠϠͰͷΩϟογϡΛओʹߦ͏ܥ

Slide 85

Slide 85 text

ϛυϧ΢ΣΞબఆͷ࿩͸ ࣌ؒ༨ͬͨΒ΍Γ·͢

Slide 86

Slide 86 text

Ωϟογϡઓུ

Slide 87

Slide 87 text

Ωϟογϡઓུ

Slide 88

Slide 88 text

Ωϟογϡઓུ ͱʹ͔͘ߴ଎ʹฦ͢

Slide 89

Slide 89 text

Ωϟογϡઓུ ͱʹ͔͘ߴ଎ʹฦ͢ ߴ଎ʹฦ[ͤ͞]ͳ͍Ωϟογϡ͸ແҙຯ

Slide 90

Slide 90 text

Ωϟογϡઓུ ΞϓϦΛյ͞ͳ͍

Slide 91

Slide 91 text

Ωϟογϡઓུ ΞϓϦΛյ͞ͳ͍ ΞϓϦΛͿͬյ͢Ωϟογϡ͸ແҙຯ

Slide 92

Slide 92 text

Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ - Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)

Slide 93

Slide 93 text

Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ - Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)

Slide 94

Slide 94 text

ґଘίϯϙʔωϯτΛগͳ͘อͭ - ґଘίϯϙʔωϯτ͕૿͑Δ = ো֐఺͕૿͑Δ - ো֐఺͸গͳ͍ํ͕ྑ͍ - ҆қʹϛυϧ΢ΣΞΛ૿΍͞ͳ͍ - ʮ࢖ͬͯΈ͔͔ͨͬͨΒʯΛؾܰʹ΍Δͱ
 ͲΜͲΜट͕క·Δ

Slide 95

Slide 95 text

Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ - Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)

Slide 96

Slide 96 text

লϝϞϦ - ϝϞϦΛϞϦϞϦ৯͏ઃܭΛආ͚Δ - ࠷ॳ͸ྑ͍͔΋͠Εͳ͍͕͋Δ೔ಥવ
 ো֐͕ى͖ͨΓ͢Δ - (؂ࢹ͠Ζͱ͍͏࿩Ͱ͸͋Δ͕……) - جຊతʹΩϟογϡ͢ΔΞΠςϜʹ͸
 ExpireΛ෇͚Δ (= ӬଓతʹσʔλΛ࣋ͨͳ͍)

Slide 97

Slide 97 text

Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ - Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)

Slide 98

Slide 98 text

Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - Ωϟογϡ͸յΕΔ΋ͷͱͯ͠ӡ༻ͨ͠΄͏͕޾ͤ - Ωϟογϡ͕ͿͬյΕͨΒ·ͨ࡞Ε͹ྑ͍ - Let it crash - ͨͩɼͿͬյΕͨλΠϛϯάͰٸܹʹෛՙ্͕͕Δ
 Α͏ͳঢ়گʹ͚ͩͳΒͳ͍Α͏޻෉͢΂͖

Slide 99

Slide 99 text

Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ - Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)

Slide 100

Slide 100 text

ͳΔ΂ۚ͘Λ͔͚ͳ͍ - ͸͍

Slide 101

Slide 101 text

Ωϟογϡύλʔϯ

Slide 102

Slide 102 text

ύλʔϯʁ ʮͦΕͧΕͷύλʔϯ͸զʑͷ਎ͷ·ΘΓͰԿճ΋ى͖Δ໰୊ɺ͓ ΑͼɺͦΕͧΕͷ໰୊ʹର͢Δղ๏ͷϙΠϯτΛهड़͍ͯ͠Δɻͦ ͜Ͱզʑ͸ɺ͜ΕΒͷղ๏ΛԿສճͰ΋࢖͏͜ͱ͕Ͱ͖Δɻಉ͡໰ ୊ʹର͢Δಉ͡ղ๏ΛԿ౓΋Կ౓΋࠷ॳ͔Βߟ͑௚ͣ͞ʹࡁΉͱ͍ ͏Θ͚ͩʯ ― Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides ஶ, ຊҐా ਅҰ, ٢ా࿨थ ؂༁ σβΠϯύλʔϯɼվగ൛ ❞

Slide 103

Slide 103 text

ύλʔϯԽ͢Δར఺ͱ͸ ʮύλʔϯʹ໊લΛ෇͚Δ͜ͱͰɺઃܭͷ͓͚Δ༻ޠͷޠኮΛ૿΍ ͢͜ͱʹͳΔɻͦΕʹΑͬͯߴ͍ந৅ϨϕϧͰઃܭ͢Δ͜ͱ͕Մೳ ͱͳΔɻύλʔϯʹؔ͢Δޠኮ͕૿͑Ε͹ɺಉ྅ͱٞ࿦ͨ͠Γɺจ ॻʹه࿥ͨ͠Γɺࣗ෼ࣗ਎Ͱߟ͑Λ੔ཧ͢Δͷʹ΋໾ཱͭɻઃܭʹ ؔͯ͠ݕ౼ͨ͠Γɺઃܭ্ͷτϨʔυΦϑΛਓʹ఻͑Δ͜ͱ΋༰қ ʹͳΔʯ ― Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides ஶ, ຊҐా ਅҰ, ٢ా࿨थ ؂༁ σβΠϯύλʔϯɼվగ൛ ❞

Slide 104

Slide 104 text

ύλʔϯԽ͢Δར఺ͱ͸ ʮҰ౓໊લΛݺͿ͜ͱ͕Ͱ͖Ε͹ɺ͋ͳͨ͸ͦΕΛҙࣝ͠ɺͦΕΛ ࢧ഑͠ɺͦΕΛॴ༗͠ɺͦΕΛίϯτϩʔϧͰ͖ΔΑ͏ʹͳΔͷͰ ͢ʯ ― Robin Williams ஶ, ٢઒యल ༁ɹ ϊϯσβΠφʔζɾσβΠϯϒοΫ ❞

Slide 105

Slide 105 text

Ωϟογϡͷύλʔϯ - Ωϟογϡʹ͍ͭͯͷύλʔϯɼΈ͍ͨͳ࿩Λ͋·Γ ฉ͔ͳ͍ - ݁Ռͱͯ͠ʮ✕✕✕͕˓˓˓Ͱ˚˚˚ʹͳΔ΍ͭͰ͢ʯ Έ͍ͨͳৄࡉͳจষͰίϛϡχέʔγϣϯ͢Δ͜ͱ
 ʹͳΔ => ͨΔ͍

Slide 106

Slide 106 text

Ωϟογϡͷύλʔϯ - ͱ͍͏Θ͚ͰύλʔϯͰ͢ʂʂ - উखʹ෇໊͚ͨલͳΜͰ΋͏طʹผͷ໊લ͕͋Δ͔΋

Slide 107

Slide 107 text

(ݸਓతʹ) Α͘࢖͏ ύλʔϯΛ͝঺հʂ

Slide 108

Slide 108 text

Brokerύλʔϯ - Ωϟογϡʹ͋ͬͨΒΩϟογϡ͔Βฦ͢ - Ωϟογϡʹແ͔ͬͨΒҰ࣍ετϨʔδʹ໰͍߹Θ ͤͯͦͷ݁ՌΛฦͭͭ͠ΩϟογϡʹೖΕΔ ϦΫΤετͯ͠…… ϦϙδτϦύλʔϯͷѥछͱݴ͑ͦ͏

Slide 109

Slide 109 text

Server Client Primary Storage ii iii Cache Storage Brokerύλʔϯ i ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. ώοτͨ͠ͷͰ݁ՌΛฦ͢ iv. Ϩεϙϯε

Slide 110

Slide 110 text

Server Client Primary Storage ii iii Cache Storage Brokerύλʔϯ i ii iii iv v vi i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. Ωϟογϡʹແ͍ͷͰ
 Ұ࣍ετϨʔδ໰͍߹Θͤ iv. ݁ՌΛΩϟογϡʹೖΕΔ v. ݁ՌΛฦ͢ vi. Ϩεϙϯε

Slide 111

Slide 111 text

Brokerύλʔϯ Pros - ΞΫηεස౓ͷߴ͍ίϯςϯπ͸Ωϟογϡʹ৐Γ
 ௿͍ίϯςϯπ͸Ωϟογϡʹ৐Βͳ͍
 লϝϞϦ - σʔλͷ੔߹ੑΛอͪ΍͍͢ (Ωϟογϡ͕৽઱) Cons - ࠷ॳʹίϯςϯπʹདྷͨਓ͕ॏ͘ͳΔ - Ωϟογϡʹ৐͍ͬͯͳ͍࣌ʹେྔʹΞΫηε͕དྷΔͱ
 ෳ਺ͷϦΫΤετ͕Ұ࣍ετϨʔδʹૹΒΕΔ
 Cache Thundering Herd ໰୊ (ޙड़)

Slide 112

Slide 112 text

Inventoryύλʔϯ - Ωϟογϡʹ͋ͬͨΒΩϟογϡ͔Βฦ͢ - Ωϟογϡʹແ͔ͬͨΒσϑΥϧτ஋Λฦͭͭ͠ɼ ඇಉظͰҰ࣍ετϨʔδ͔Β஋Λऔ͖ͬͯͯ
 Ωϟογϡ͢ΔΑ͏ʹ͢Δ ϦΫΤετͯ͠……

Slide 113

Slide 113 text

Inventoryύλʔϯ Server Client Primary Storage ii iii Cache Storage i ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. ώοτͨ͠ͷͰ݁ՌΛฦ͢ iv. Ϩεϙϯε

Slide 114

Slide 114 text

Inventoryύλʔϯ Server Client Primary Storage ii iii Cache Storage i ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. Ωϟογϡʹແ͍ iv. σϑΥϧτ஋Λฦ͢ (ඇಉظͰ) iv’. Ұ࣍ετϨʔδ໰͍߹Θͤ v’. ݁ՌΛΩϟογϡ iv’ v’

Slide 115

Slide 115 text

Inventoryύλʔϯ Pros - Brokerύλʔϯͱ΄΅ಉ͡Pros͕͋Δ - ࠷ॳʹίϯςϯπʹདྷͨਓʹରͯ͠΋ϨεϙϯελΠϜ͕ѱԽ
 ͠ͳ͍ Cons - ࠷ॳʹίϯςϯπʹདྷͨਓ͕ਖ਼͍͠ίϯςϯπΛऔΕͳ͍ - σϑΥϧτ஋ͷϋϯυϦϯάΛͲ͏͢Δ͔ - Cache Thundering Herd ໰୊ʹ͍ͭͯ΋ղܾ͍ͯ͠ͳ͍

Slide 116

Slide 116 text

Warmerύλʔϯ - ͦͷίϯςϯπΛΩϟογϡʹ৐ͤΔ - ΫϥΠΞϯτ͸ͦͷΩϟογϡΛࢀর͢Δ ίϯςϯπੜ੒࣌ʹ…… ϥϯΩϯάͱ͔ʹ࢖͑Δ

Slide 117

Slide 117 text

Warmerύλʔϯ Server Client Cache Storage i ii iii iv contents contents v i. ίϯςϯπੜ੒࣌ʹ
 ίϯςϯπΛΩϟογϡ ii. ϦΫΤετ iii. Ωϟογϡ໰͍߹Θͤ iv. ίϯςϯπฦ͢ v. Ϩεϙϯε

Slide 118

Slide 118 text

Warmerύλʔϯ Pros - ࠷ॳ͔ΒΩϟογϡܦ༝ͰίϯςϯπΛฦͤΔ - Cache Thundering Herd ໰୊ͷҰղܾ Cons - ίϯςϯπ͕ੜ੒͞ΕΔܥ͡Όͳ͍ͱ࢖͑ͳ͍ - ϥΠϑαΠΫϧͷ؅ཧ͕൥ࡶʹͳΔ (ಉظͱ͔) - ϝϞϦΊͬͪΌ৯͏৔߹͕͋Δ - Ωϟογϡ͕شൃͨ࣌͠ʹͲ͏͢Δͷ͔ʁ

Slide 119

Slide 119 text

Pool & Flushύλʔϯ POSTϦΫΤετܥʹ࢖͏ɽ ϦΫΤετ͕དྷͨ࣌ʹΩϟογϡʹͦͷ಺༰ΛཷΊɼ ͋ΔλΠϛϯάͰӬଓετϨʔδʹॻ͖ग़͢

Slide 120

Slide 120 text

Pool & Flushύλʔϯ Server Client Primary Storage ii iii Cache Storage i ii iii i. ϦΫΤετ ii. ΩϟογϡʹཷΊΔ iii. Ϩεϙϯε (͋ΔλΠϛϯάͰ) x. ӬଓετϨʔδʹॻ͖ग़͠ x

Slide 121

Slide 121 text

Pool & Flushύλʔϯ Pros - ߴ଎ʹߋ৽ܥΛॲཧͰ͖Δ Cons - ϓʔϧ͕ͿͬյΕͨ࣌ʹσʔλ͕ফ໓͢Δ - σʔλͷҰ؏ੑΛอͭ࿑ྗ͕͔͔Δ

Slide 122

Slide 122 text

ΫϥΠΞϯταΠυΩϟογϡ

Slide 123

Slide 123 text

HTTP HeaderΛ༻͍ͨΩϟογϡ Server Client i ii i. ϦΫΤετ ii. ϔομ෇͚ͯฦ͢ - Expires - Cache-Control - Last-Modified - ETag contents

Slide 124

Slide 124 text

HTTP HeaderΛ༻͍ͨΩϟογϡ Server Client i ii i. ৚݅ͷϔομ෇͚ͯ
 ϦΫΤετ - If-Modified-Since - If-None-Match ii. ৚݅ʹैͬͯฦ͢ contents contents

Slide 125

Slide 125 text

HTTP HeaderΛ༻͍ͨΩϟογϡ Server Client i ii i. ৚݅ͷϔομ෇͚ͯ
 ϦΫΤετ - If-Modified-Since - If-None-Match ii. ৚݅ʹैͬͯฦ͢ contents contents ແବʹίϯςϯπΛฦ͢ඞཁ͕ແ͘ͳΔ

Slide 126

Slide 126 text

ϩʔΧϧͷ؀ڥ಺Ͱ׬݁ͤ͞Δ - ΋͸΍ΩϟογϡͲ͜ΖͰ͸ͳ͍ - ྫ: - ӾཡཤྺΛΫϥΠΞϯτͰ࣋ͬͯ΋Β͏ - λΠϜϥΠϯ࣮૷ΛΫϥΠΞϯτͷετϨʔδʹ ࣋ͬͯ΋Β͏

Slide 127

Slide 127 text

αʔό͔Βฦ͞ͳ͍ͷ͕ ݁ہ͍ͪ͹Μʂʂʂ

Slide 128

Slide 128 text

Ωϟογϡʹ·ͭΘΔॾ໰୊

Slide 129

Slide 129 text

Cache Thundering Herd ௨ৗɺΩϟογϡʹ֨ೲ͞ΕΔσʔλ͸ɺͦΕͧΕ୯Ұͷੜଘ࣌ؒ Λ΋͍ͬͯ·͢ɻ໰୊͸ɺසൟʹΞΫηε͞ΕΔΩϟογϡσʔλ ͕ΤΫεύΠΞͨ͠ࡍʹൃੜ͠·͢ɻσʔλ͕ΤΫεύΠϠͨ͠ॠؒ ͔Βɺฒߦʹ૸Δෳ਺ͷΞϓϦέʔγϣϯϩδοΫ͕ϛεώοτΛ ݕ஌͠ɺ͍ͣΕ͔ͷϓϩηε͕ΩϟογϡσʔλΛ֨ೲ͢Δ·Ͱͷ ؒɺಉҰͷϦΫΤετ͕ଟ਺ɺόοΫΤϯυʹඈΜͰ͠·͏ͷͰ͢ɻ ―ΩϟογϡγεςϜͷ Thundering Herd ໰୊ (Kazuho@Cybozu Labs) http://labs.cybozu.co.jp/blog/kazuho/archives/2007/09/cache_and_thundering_herd.php ❞

Slide 130

Slide 130 text

Cache Thundering Herd - ΤϯτϦ͝ͱʹExpireͷपظΛόϥ͢ͱ͔ - ಉҰ಺༰ͷΤϯτϦΛ2ॏʹ༻ҙ͓͍ͯͯ͠ɼ
 ͲͪΒ͔ҰํΛૣ͘ (΋͘͠͸஗͘) Expireͤ͞Δͱ͔ ͦ͏͍͏ରࡦɾ޻෉͕ඞཁͱͳΔ

Slide 131

Slide 131 text

ಉظ Ωϟογϡͷ಺༰ͱӬଓετϨʔδͷ಺༰ͷ
 ಉظͲ͏͢ΔΜ͡Ό໰୊

Slide 132

Slide 132 text

ಉظ - ΞϓϦέʔγϣϯ͸جຊతʹӬଓετϨʔδʹର ͯ͠ߋ৽ΛՃ͍͑ͯ͘
 Ωϟογϡ͸࣮͸ݹ͍ίϯςϯπ͔΋ - ͪΌΜͱ಺༰Λಉظͤ͞Α͏ͱ͢Δͱେม - Ωϟογϡ͕ਧ͖ඈͿͱӬଓԽ͞Εͳ͍ɼ
 ͳΜ͍ͯ͏໰୊΋͋Γ͑Δ

Slide 133

Slide 133 text

ಉظ ORMΛ࢖ͬͯDBͱΩϟογϡΛಁաతʹѻ͏ͱ͍͏ ख๏͕͋Δʹ͸͋Δ͕஍ࠈײ

Slide 134

Slide 134 text

ಉظ ࣃΛ৯͍͠͹ͬͯ΍Δ͔͠ͳ͍ͷ͔……

Slide 135

Slide 135 text

ෆ۩߹ى͖ͨͱ͖ͷσόοά͕௒͠ʹ͍͘ ʮ͋Εɼ͜ΕΩϟογϡ౰ͨͬͯΔΜͰ͔͢ʯ ʮ͍΍ɼDB͔Βऔ͖ͬͯͯΔΜ͡Όͳ͍ʯ ʮͳΜ͔஋͕ͣΕͯΔΜͰ͢ΑͶʯ ʮΤοɼ͜ΕͲ͏ͳͬͯΜͩʁʯ

Slide 136

Slide 136 text

ෆ۩߹ى͖ͨͱ͖ͷσόοά͕௒͠ʹ͍͘ ʮ͋Εɼ͜ΕΩϟογϡ౰ͨͬͯΔΜͰ͔͢ʯ ʮ͍΍ɼDB͔Βऔ͖ͬͯͯΔΜ͡Όͳ͍ʯ ʮͳΜ͔஋͕ͣΕͯΔΜͰ͢ΑͶʯ ʮΤοɼ͜ΕͲ͏ͳͬͯΜͩʁʯ ͋Γ͕ͪʂʂʂʂʂʂ

Slide 137

Slide 137 text

ෆ۩߹ى͖ͨͱ͖ͷσόοά͕௒͠ʹ͍͘ ͜Ε͹͔ͬΓ͸΍Δ͔͠ͳ͍……

Slide 138

Slide 138 text

ෆ۩߹ى͖ͨͱ͖ͷσόοά͕௒͠ʹ͍͘ օ͞Μ΋ͦΕͧΕͷmemcachedͷҝͷπʔϧ΍ RedisͷҝͷπʔϧΛ͍࣋ͬͯΔ͜ͱͰ͠ΐ͏ (͋Δ͍͸ϓϩτίϧΛ஻ΕΔΑ͏ʹਐԽ͢Δ)

Slide 139

Slide 139 text

ෆ۩߹ى͖ͨͱ͖ͷσόοά͕௒͠ʹ͍͘ ͋ͱ͸ϩάΛϞϦϞϦ࢓ࠐΉΈ͍ͨͳ ݹࣜΏ͔͍͠ख๏ (஍ຯ͕ͩޮ͘)

Slide 140

Slide 140 text

Ωϟογϡϛυϧ΢ΣΞ૿͑Δ໰୊ Ωϟογϡͷҝʹϛυϧ΢ΣΞ͕૿͑Δ ୯७ʹো֐ཁҼ͕૿͑Δʂʂʂʂʂ

Slide 141

Slide 141 text

Ωϟογϡϛυϧ΢ΣΞ૿͑Δ໰୊ γεςϜΛ҆ఆͤ͞ΔͨΊʹಋೖͨ͠ Ωϟογϡϛυϧ΢ΣΞ͕ෆ҆ఆͳ͹͔Γʹ ҎલΑΓ΋Քಇ཰͕Լ͕ͬͯ͠·͏ͱ͍͏஍ࠈ

Slide 142

Slide 142 text

Ωϟογϡϛυϧ΢ΣΞ૿͑Δ໰୊ - ΈͩΓʹϛυϧ΢ΣΞΛ૿΍͞ͳ͍ํ޲ͰؤுΔ - طଘͷίϯϙʔωϯτͰ୅༻͕Ͱ͖Δ͔΋ʁ

Slide 143

Slide 143 text

Ͳ͏͍͏࣌ʹΩϟογϡΛ࢖Θͳ͍΂͖͔

Slide 144

Slide 144 text

σʔλ͕ফ͑Δͱக໋తͳ৔߹ - σʔλ͕ڏۭʹফ͑ΔͱഛঈʂʂɹΈ͍ͨͳ
 ͱ͜Ζʹ͸࢖͏΂͖Ͱ͸ͳ͍ - Ωϟογϡͷσʔλ͸ফ͑Δ΋ͷͱߟ͑Δ

Slide 145

Slide 145 text

σʔλ͕ফ͑Δͱக໋తͳ৔߹ - σʔλ͕ڏۭʹফ͑ΔͱഛঈʂʂɹΈ͍ͨͳ
 ͱ͜Ζʹ͸࢖͏΂͖Ͱ͸ͳ͍ - Ωϟογϡͷσʔλ͸ফ͑Δ΋ͷͱߟ͑Δ ͔͠͠αʔϏεӡ༻্ফ͑ͯ΋ྑ͍σʔλ ͳΜͯ΄ͱΜͲͳ͍ͧʂʂʂ

Slide 146

Slide 146 text

ΩϟογϡΛ࠶ߏஙग़དྷͳ͍৔߹ - Ωϟογϡͷσʔλ͸ͿͬյΕͯ΋࠶ߏங
 Ͱ͖Ε͹໰୊ͳ͍ - όονͰDB͔ΒΩϟογϡ࠶ੜ੒ͱ͔Ͱ - ٯʹݴ͏ͱΩϟογϡΛ࠶ߏஙͰ͖ͳ͍৔߹͸
 ࢖͏΂͖Ͱ͸ͳ͍

Slide 147

Slide 147 text

ଞʹ΋৭ʑ͋Δ…… ݁ߏΩϟογϡΛ࢖͏΂͖Ͱ͸ͳ͍Օॴ͸ ਎ۙʹᷓΕ͍ͯΔ

Slide 148

Slide 148 text

Ωϟογϡ͸ຑༀ

Slide 149

Slide 149 text

Ωϟογϡʹ·ͭΘΔॾ໰୊Λ͏͚ͯ ΩϟογϡϚδَ໳

Slide 150

Slide 150 text

Ұ౓ΩϟογϡΛ࢖͏ͱ໭Εͳ͘ͳΔ - ҆қͳؾ࣋ͪͰΩϟογϡΛ࢖͏ͱ
 ͦͷ෦෼͕͏͔ͬΓ଎͘ͳͬͯ͠·͏ - ଞͷ෦෼Ͱ΋ͦͷߴ଎͞ΛٻΊΒΕΔ
 ͠ΐ͏͕ͳ͍ͷͰΩϟογϡ࢖͍·͔͢…… - Α͏ͦ͜Ωϟογϡপ΁

Slide 151

Slide 151 text

Ұ౓ΩϟογϡΛ࢖͏ͱ໭Εͳ͘ͳΔ - Ωϟογϡ͸جຊతʹෳࡶͳػߏ - ೖΕΔͷ͸؆୯ɼൈ͘ͷ͕೉͍͠ - ΩϟογϡͱҰੜ෇͖߹͍֮ͬͯ͘ޛ͕͋Δ͔

Slide 152

Slide 152 text

Ωϟογϡ೴ͷڪාʂʂʂ ʮͳΜ͔͜ͷ෦෼஗͍ͬ͢Ͷ͑ʯ ʮDB٧·ͬͯΜ͡ΌΜʁɹΩϟογϡ͠Α͏ͥʯ ʮOKOKʯ

Slide 153

Slide 153 text

Ωϟογϡ೴ͷڪාʂʂʂ ʮͳΜ͔͜ͷ෦෼஗͍ͬ͢Ͷ͑ʯ ʮDB٧·ͬͯΜ͡ΌΜʁɹΩϟογϡ͠Α͏ͥʯ ʮOKOKʯ OKͰ͸ͳ͍ʂʂʂʂʂ

Slide 154

Slide 154 text

Ωϟογϡ೴ͷڪාʂʂʂ ஗͍ʂ ෲཱͭʂʂ Ωϟογϡ͢Δʂʂʂ

Slide 155

Slide 155 text

҆қͳΩϟογϡΛ ΍ΊΖʂʂʂʂ

Slide 156

Slide 156 text

ͪΌΜͱઃܭΛ͢Δ

Slide 157

Slide 157 text

ͪΌΜͱઃܭΛ͢Δ - ͪΌΜͱDB (σʔλϞσϧ) ͷઃܭΛ͢Δ - ΠϯσοΫεͱ͔΋ؚΊͯ - มͳΞʔΩςΫνϟΛ΍ΊΔ - ϘτϧωοΫʹͳΓ͕ͪ - ʮ౰ͨΓલͷ͜ͱΛ౰ͨΓલʹ΍Δʯ

Slide 158

Slide 158 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query

Slide 159

Slide 159 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query ΫΤϦ (͋Δ͍͸ςʔϒϧ)Λ௚ͤʂʂʂ ద੾ʹνϡʔχϯά͞ΕͨΫΤϦʹ͸
 ΩϟογϡͳͲෆཁ

Slide 160

Slide 160 text

Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query Slave Slave ΩϟογϡʹཔΒͣ SlaveΛฒ΂Δ΋Α͠

Slide 161

Slide 161 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Request (via HTTP)

Slide 162

Slide 162 text

֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Request (via HTTP) ֎෦αʔϏεʹґଘ͠ͳ͍ ํ๏Λߟ͑Δ

Slide 163

Slide 163 text

ͪΌΜͱଌఆΛ͢Δ

Slide 164

Slide 164 text

ͪΌΜͱଌఆΛ͢Δ - ΩϟογϡΛ༻͍Δ͜ͱͰຊ౰ʹޮ͍͍ͯΔͷ͔ - ෛՙ͕Լ͕͍ͬͯΔʁ - ϨεϙϯελΠϜ͕վળ͍ͯ͠Δʁ - αʔϏεͷՄ༻ੑ্͕ঢ͍ͯ͠Δʁ

Slide 165

Slide 165 text

ͪΌΜͱଌఆΛ͢Δ - ΩϟογϡΛ༻͍Δ͜ͱͰຊ౰ʹޮ͍͍ͯΔͷ͔ - ෛՙ͕Լ͕͍ͬͯΔʁ - ϨεϙϯελΠϜ͕վળ͍ͯ͠Δʁ - αʔϏεͷՄ༻ੑ্͕ঢ͍ͯ͠Δʁ ΩϟογϡΛೖΕ͚ͨͩͰ
 تΜͰ͍ͯ͸ବ໨

Slide 166

Slide 166 text

ͪΌΜͱଌఆΛ͢Δ - ΩϟογϡΛ༻͍Δ͜ͱͰຊ౰ʹޮ͍͍ͯΔͷ͔ - େͯ͠ޮ͔͵ΩϟογϡͳΒೖΕΔ͚ͩෛ࠴

Slide 167

Slide 167 text

Ωϟογϡ͸ຑༀ Ωϟογϡ͸࠷ऴฌث

Slide 168

Slide 168 text

ຊ౰ʹඞཁͳ࣌ʹ͚ͩ ΩϟογϡΛ࢖͍·͠ΐ͏

Slide 169

Slide 169 text

࢖Θͳͯ͘ࡁΉͷͳΒ ΩϟογϡΛ΍ΊΑ͏ʂʂ

Slide 170

Slide 170 text

Q?

Slide 171

Slide 171 text

͕࣌ؒ͋Ε͹ͷίʔφʔ

Slide 172

Slide 172 text

Varnishͷ࿩Λ͍ͯ͠·ͤΜͶʁ

Slide 173

Slide 173 text

Varnishͷ࿩Λ͍ͯ͠·ͤΜͶʁ - ͢Έ·ͤΜαʔϏεͰ࢖ͬͨ͜ͱͳ͍ͷͰ
 Ұ੾஻Ε·ͤΜ - ༗ӹͳ࿩͸Πϯλʔωοτ্ʹ͸ͨ͘͞Μ
 ࢿྉ͕͋Γ·͢ (YAPC 2011ͷmala͞ΜͷࢿྉͳͲ) - Πϯλʔωοτʹ͸ͳΜͰ΋͋Δ

Slide 174

Slide 174 text

ΩϟογϡετϨʔδબఆ

Slide 175

Slide 175 text

ΩϟογϡετϨʔδબఆ - ༻్ - ෼ࢄ͢Δඞཁ͕͋Δ͔ - ৑௕Խ͢Δඞཁ͕͋Δ͔ - ࢖ͬͯΔΫϥ΢υϓϥοτϑΥʔϜͰαϙʔτ
 ͍ͯ͠Δ͔Ͳ͏͔ - ετϨʔδʹৄ͍͠ਓ͕͍Ε͹ྑ͍

Slide 176

Slide 176 text

ΩϟογϡετϨʔδબఆ

Slide 177

Slide 177 text

ΩϟογϡετϨʔδͷ ৑௕Խߏ੒ʹ͍ͭͯ

Slide 178

Slide 178 text

৑௕Խ - Redisͩͱsentinelͱ͔clusterͱ͔ - memdͷ৔߹͸ܥΛෳ਺༻ҙ͢Δͱ͔ - ࣗ෼ͰϧʔςΟϯάΛॻ͘ඞཁ͕͋Δ - ͍҃͸mcrouterͳͲ…… - ຊ౰ʹ৑௕Խ͕ඞཁͳͷ͔Ͳ͏͔Λߟ͑Δ
 ඞཁ͸͋Δ