Pro Yearly is on sale from $80 to $50! »

Webアプリケーションのキャッシュ戦略とそのパターン / Pattern and Strategy of Web Application Caching

672ee2598bea695496f11022a9a9c4c8?s=47 moznion
March 04, 2017

Webアプリケーションのキャッシュ戦略とそのパターン / Pattern and Strategy of Web Application Caching

YAPC::Kansai OSAKA 2017の資料です

672ee2598bea695496f11022a9a9c4c8?s=128

moznion

March 04, 2017
Tweet

Transcript

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

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

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

  5. Ωϟογϡ

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

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

  8. Ωϟογϡͱ͸ͳʹ͔ʁ

  9. Ωϟογϡʁ ʮΩϟογϡ: ෺ΛӅͨ͠Γ֨ೲͨ͠Γ͓ͯ͘͠ͷʹ҆શͳ৔ॴʯ ― Webster ৽ੈքถޠࣙయɼΧϨοδ൛ ୈ3൛ ʮΩϟογϡͱ͸ௐ΂Δඞཁͷ͋Δ΋ͷΛஔ͍͓ͯ҆͘શͳ৔ॴͷ ͜ͱͰ͋ΔɽΩϟογϡͱ͍͏༻ޠ͸ɼ࠷ॳͷ঎༻ίϯϐϡʔλʹ ͓͍ͯɼϓϩηοαͱओهԱͱͷؒʹૠೖ͞ΕͨهԱ֊૚ϨϕϧΛ

    දͨ͢Ίʹ࢖༻͞Εͨɽ(தུ) ͜ͷ༻ޠ͸ࠓ೔Ͱ͸ࢀরͷہॴੑΛ ར༻͢ΔΑ͏ʹ؅ཧ͞Εͨ೚ҙͷهԱΛࢦͯ͠΋࢖༻͞ΕΔʯ ― σΠϏου A ύλʔιϯ, δϣϯ ̡ ϔωγʔ ஶ, ੒ా ޫজ ༁ ίϯϐϡʔλͷߏ੒ͱઃܭɼୈ5൛ [Լ] ❞ ❞
  10. ͳΔ΄Ͳ…

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

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

  13. Ωϟογϡʁ ʮΩϟογϡ: ෺ΛӅͨ͠Γ֨ೲͨ͠Γ͓ͯ͘͠ͷʹ҆શͳ৔ॴʯ ― Webster ৽ੈքถޠࣙయɼΧϨοδ൛ ୈ3൛ ʮΩϟογϡͱ͸ௐ΂Δඞཁͷ͋Δ΋ͷΛஔ͍͓ͯ҆͘શͳ৔ॴͷ ͜ͱͰ͋ΔɽΩϟογϡͱ͍͏༻ޠ͸ɼ࠷ॳͷ঎༻ίϯϐϡʔλʹ ͓͍ͯɼϓϩηοαͱओهԱͱͷؒʹૠೖ͞ΕͨهԱ֊૚ϨϕϧΛ

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

    දͨ͢Ίʹ࢖༻͞Εͨɽ(தུ) ͜ͷ༻ޠ͸ࠓ೔Ͱ͸ࢀরͷہॴੑΛ ར༻͢ΔΑ͏ʹ؅ཧ͞Εͨ೚ҙͷهԱΛࢦͯ͠΋࢖༻͞ΕΔʯ ― σΠϏου A ύλʔιϯ, δϣϯ ̡ ϔωγʔ ஶ, ੒ా ޫজ ༁ ίϯϐϡʔλͷߏ੒ͱઃܭɼୈ5൛ [Լ] ❞ ❞ جຊతͳ֓೦ͱͯ͠͸ͦͷ௨Γ Ͱ΋͜Εϓϩηοαͷ࿩ͩʂ
  15. ࠓճ࿩͞ͳ͍͜ͱ - WebΞϓϦέʔγϣϯҎ֎ͷΩϟογϡʹ͍ͭͯ - e.g - ϓϩηοαͷΩϟογϡ - DNSΩϟογϡʹ͍ͭͯ΋ࠓճ͸͠·ͤΜ -

    ଞʹ΋৭ʑͳ࿩Λ͠·ͤΜ
  16. WebΞϓϦέʔγϣϯʹ͓͚Δ Ωϟογϡͱ͸ͳʹ͔ʁ

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

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

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

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

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

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

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

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

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

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

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

  28. HTTPϨΠϠͰͷΩϟογϡ Ωϟογϡͱ͸ɺϦιʔεͷ઱౓ʹج͍ͮͯɺҰ౓औಘͨ͠Ϧιʔ εΛΫϥΠΞϯτଆͰ࢖͍·Θ͢ํࣜͰ͢ɻ Ωϟογϡͷར఺͸ɺαʔόͱΫϥΠΞϯτؒͷ௨৴ΛݮΒ͢͜ͱ ͰωοτϫʔΫଳҬͷར༻΍ॲཧ࣌ؒΛॖখ͠ɺΑΓޮ཰తʹॲཧ Ͱ͖Δ͜ͱͰ͢ɻ ― ࢁຊ ཅฏ ஶ

    WebΛࢧ͑Δٕज़ - HTTPɺURIɺHTMLɺͦͯ͠REST (WEB+DB PRESS plus) ❞
  29. HTTPϨΠϠͰͷΩϟογϡ Server Client contents

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

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

    ίϯςϯπ͕ωοτϫʔΫʹ৐Δ (serverͷཪଆͰ͸ߋʹॏ͍ॲཧ͕૸͍ͬͯΔ͔΋) contents
  32. HTTPϨΠϠͰͷΩϟογϡ Server Client contents contents ΫϥΠΞϯτଆͰίϯςϯπΛอ࣋

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

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

    ΋͏࣋ͬͯ·͢Α ίϯςϯπ͸ωοτϫʔΫʹ৐Βͳ͍ ʮ΋͏࣋ͬͯ·͢Αʯͱ͍͏৘ใ͕৐Δ
  35. HTTPϨΠϠͰͷΩϟογϡ ͨͩ͠ɺݹ͍ΩϟογϡΛར༻ͯ͠͠·͍ɺ৘ใͷ৴པੑ͕Լ͕Δ Մೳੑ΋͋Γ·͢ɻ ― ࢁຊ ཅฏ ஶ WebΛࢧ͑Δٕज़ - HTTPɺURIɺHTMLɺͦͯ͠REST

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

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

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

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

    RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)
  40. ϦΫΤετΛߴ଎ʹฦ٫͢Δ Server Client Cache Storage ߴ଎ʹฦ٫͢Δ͜ͱͰ ετϨε͕গͳ͘ͳΓ ϢʔβʔମݧΞοϓʂ ⚡⚡⚡

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

    RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)
  42. ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺ͷ૿Ճ Server Client Cache Storage ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺ ૿ՃʹΑΓҰ౓ʹ ͨ͘͞ΜͷϦΫΤετΛ ͞͹͚Δ Client

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

    RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ)
  44. ಛఆίϯϙʔωϯτͷෛՙܰݮ Server Client Client . . . Storage (৭ʑͳࣄ͕͋Γ) ετϨʔδʹෛՙ͕ूத͍ͯ͠Δʂ

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

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

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

    ͔͠͠Ωϟογϡίϯϙʔωϯτ͕ ૿͑Δ͜ͱͰγεςϜͱͯ͠ͷ ނোՄೳੑ͸૿Ճ͢Δʂ
  48. ͳͥΩϟογϡΛ࢖͏ͷ͔ʁ ϦΫΤετΛߴ଎ʹฦ٫͢ΔͨΊ Ϣʔβମݧͷ޲্ ୯Ґ࣌ؒ͋ͨΓͷॲཧ਺Λ૿Ճͤ͞ΔͨΊ ܭࢉػϦιʔεͷར༻ޮ཰্ঢ ɹɹRequest per secondͷ૿Ճ ಛఆίϯϙʔωϯτ (e.g.

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

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

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

    RDBMS) ͷෛՙ௿ݮͷͨΊ γεςϜͷ҆ఆӡ༻ (͔͠͠৔߹ʹґΔ) ͭ·ΓΧω΍ʂʂʂ Ωϟογϡ͔ʂʁ
  52. ͸͍

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

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

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

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

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

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

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

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

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

  62. Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Cache Ωϟογϡʹಀ͕͢͜ͱͰ

    ݱ࣮తͳ࣌ؒͰฦ͢ (ෛՙ΋෼ࢄͤ͞Δ)
  63. ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

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

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

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

    ϦΫΤετ͕ଟ͗ͯ͢ࡹ͖͖Εͳ͍
  67. ৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ Server . . . Storage Cache

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

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

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

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

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

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

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

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

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

    ΩϟογϡΛ஥հ͢Δ͜ͱͰ ߴ଎ʹ݁ՌΛಘΔͱͱ΋ʹ ෆཁͳϦΫΤετΛ࡟ݮ͢Δ
  77. ΩϟογϡΛͲͷΑ͏ͳ࣌ʹ࢖͏͔ - Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ (৭ʑͳ͜ͱ͕͋Δ) - ৭ʑͳཧ༝ͰৗيΛҳͨ͠ྔͷΞΫηε͕͋Δ - ৭ʑ͋ͬͯ֎෦αʔϏεʹґଘ͍ͯ͠Δ - ͳͲͳͲ

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

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

    ৭ʑͳ͜ͱ͕͋Δɼ৭ʑͳ͜ͱ͕…… ͔͠͠ຊ౰ʹΩϟογϡ͕ඞཁͳͷ͔͸ख़ߟ͢΂͖ɽޙड़
  80. ΩϟογϡετϨʔδ

  81. ΩϟογϡετϨʔδ֓؍ - memcached - memcachedϓϩτίϧΛ஻Δ஥ؒ - Redis - BerkeleyDB -

    mmap (!) - ΞϓϦͷϓϩηε಺ʹ࣋ͭ - ͳͲͳͲ
  82. ͦͷଞͷΩϟογϡϛυϧ΢ΣΞ

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

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

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

  86. Ωϟογϡઓུ

  87. Ωϟογϡઓུ

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

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

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

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

  92. Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ -

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

    Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)
  94. ґଘίϯϙʔωϯτΛগͳ͘อͭ - ґଘίϯϙʔωϯτ͕૿͑Δ = ো֐఺͕૿͑Δ - ো֐఺͸গͳ͍ํ͕ྑ͍ - ҆қʹϛυϧ΢ΣΞΛ૿΍͞ͳ͍ -

    ʮ࢖ͬͯΈ͔͔ͨͬͨΒʯΛؾܰʹ΍Δͱ
 ͲΜͲΜट͕క·Δ
  95. Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ -

    Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)
  96. লϝϞϦ - ϝϞϦΛϞϦϞϦ৯͏ઃܭΛආ͚Δ - ࠷ॳ͸ྑ͍͔΋͠Εͳ͍͕͋Δ೔ಥવ
 ো֐͕ى͖ͨΓ͢Δ - (؂ࢹ͠Ζͱ͍͏࿩Ͱ͸͋Δ͕……) - جຊతʹΩϟογϡ͢ΔΞΠςϜʹ͸


    ExpireΛ෇͚Δ (= ӬଓతʹσʔλΛ࣋ͨͳ͍)
  97. Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ -

    Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)
  98. Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - Ωϟογϡ͸յΕΔ΋ͷͱͯ͠ӡ༻ͨ͠΄͏͕޾ͤ - Ωϟογϡ͕ͿͬյΕͨΒ·ͨ࡞Ε͹ྑ͍ - Let it crash -

    ͨͩɼͿͬյΕͨλΠϛϯάͰٸܹʹෛՙ্͕͕Δ
 Α͏ͳঢ়گʹ͚ͩͳΒͳ͍Α͏޻෉͢΂͖
  99. Ωϟογϡઓུ - ߴ଎ʹฦ͢ - ΞϓϦΛͿͬյ͞ͳ͍ - ґଘίϯϙʔωϯτΛগͳ͘อͭ - লϝϞϦ -

    Ωϟογϡ͕ͿͬյΕͯ΋ٽ͔ͳ͍ - (ͳΔ΂ۚ͘Λ͔͚ͳ͍)
  100. ͳΔ΂ۚ͘Λ͔͚ͳ͍ - ͸͍

  101. Ωϟογϡύλʔϯ

  102. ύλʔϯʁ ʮͦΕͧΕͷύλʔϯ͸զʑͷ਎ͷ·ΘΓͰԿճ΋ى͖Δ໰୊ɺ͓ ΑͼɺͦΕͧΕͷ໰୊ʹର͢Δղ๏ͷϙΠϯτΛهड़͍ͯ͠Δɻͦ ͜Ͱզʑ͸ɺ͜ΕΒͷղ๏ΛԿສճͰ΋࢖͏͜ͱ͕Ͱ͖Δɻಉ͡໰ ୊ʹର͢Δಉ͡ղ๏ΛԿ౓΋Կ౓΋࠷ॳ͔Βߟ͑௚ͣ͞ʹࡁΉͱ͍ ͏Θ͚ͩʯ ― Erich Gamma, Richard

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

    Richard Helm, Ralph Johnson, John Vlissides ஶ, ຊҐా ਅҰ, ٢ా࿨थ ؂༁ σβΠϯύλʔϯɼվగ൛ ❞
  104. ύλʔϯԽ͢Δར఺ͱ͸ ʮҰ౓໊લΛݺͿ͜ͱ͕Ͱ͖Ε͹ɺ͋ͳͨ͸ͦΕΛҙࣝ͠ɺͦΕΛ ࢧ഑͠ɺͦΕΛॴ༗͠ɺͦΕΛίϯτϩʔϧͰ͖ΔΑ͏ʹͳΔͷͰ ͢ʯ ― Robin Williams ஶ, ٢઒యल ༁ɹ

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

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

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

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

  109. Server Client Primary Storage ii iii Cache Storage Brokerύλʔϯ i

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

    ii iii iv v vi i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. Ωϟογϡʹແ͍ͷͰ
 Ұ࣍ετϨʔδ໰͍߹Θͤ iv. ݁ՌΛΩϟογϡʹೖΕΔ v. ݁ՌΛฦ͢ vi. Ϩεϙϯε
  111. Brokerύλʔϯ Pros - ΞΫηεස౓ͷߴ͍ίϯςϯπ͸Ωϟογϡʹ৐Γ
 ௿͍ίϯςϯπ͸Ωϟογϡʹ৐Βͳ͍
 লϝϞϦ - σʔλͷ੔߹ੑΛอͪ΍͍͢ (Ωϟογϡ͕৽઱) Cons

    - ࠷ॳʹίϯςϯπʹདྷͨਓ͕ॏ͘ͳΔ - Ωϟογϡʹ৐͍ͬͯͳ͍࣌ʹେྔʹΞΫηε͕དྷΔͱ
 ෳ਺ͷϦΫΤετ͕Ұ࣍ετϨʔδʹૹΒΕΔ
 Cache Thundering Herd ໰୊ (ޙड़)
  112. Inventoryύλʔϯ - Ωϟογϡʹ͋ͬͨΒΩϟογϡ͔Βฦ͢ - Ωϟογϡʹແ͔ͬͨΒσϑΥϧτ஋Λฦͭͭ͠ɼ ඇಉظͰҰ࣍ετϨʔδ͔Β஋Λऔ͖ͬͯͯ
 Ωϟογϡ͢ΔΑ͏ʹ͢Δ ϦΫΤετͯ͠……

  113. Inventoryύλʔϯ Server Client Primary Storage ii iii Cache Storage i

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

    ii iii iv i. ϦΫΤετ ii. Ωϟογϡ໰͍߹Θͤ iii. Ωϟογϡʹແ͍ iv. σϑΥϧτ஋Λฦ͢ (ඇಉظͰ) iv’. Ұ࣍ετϨʔδ໰͍߹Θͤ v’. ݁ՌΛΩϟογϡ iv’ v’
  115. Inventoryύλʔϯ Pros - Brokerύλʔϯͱ΄΅ಉ͡Pros͕͋Δ - ࠷ॳʹίϯςϯπʹདྷͨਓʹରͯ͠΋ϨεϙϯελΠϜ͕ѱԽ
 ͠ͳ͍ Cons - ࠷ॳʹίϯςϯπʹདྷͨਓ͕ਖ਼͍͠ίϯςϯπΛऔΕͳ͍

    - σϑΥϧτ஋ͷϋϯυϦϯάΛͲ͏͢Δ͔ - Cache Thundering Herd ໰୊ʹ͍ͭͯ΋ղܾ͍ͯ͠ͳ͍
  116. Warmerύλʔϯ - ͦͷίϯςϯπΛΩϟογϡʹ৐ͤΔ - ΫϥΠΞϯτ͸ͦͷΩϟογϡΛࢀর͢Δ ίϯςϯπੜ੒࣌ʹ…… ϥϯΩϯάͱ͔ʹ࢖͑Δ

  117. Warmerύλʔϯ Server Client Cache Storage i ii iii iv contents

    contents v i. ίϯςϯπੜ੒࣌ʹ
 ίϯςϯπΛΩϟογϡ ii. ϦΫΤετ iii. Ωϟογϡ໰͍߹Θͤ iv. ίϯςϯπฦ͢ v. Ϩεϙϯε
  118. Warmerύλʔϯ Pros - ࠷ॳ͔ΒΩϟογϡܦ༝ͰίϯςϯπΛฦͤΔ - Cache Thundering Herd ໰୊ͷҰղܾ Cons

    - ίϯςϯπ͕ੜ੒͞ΕΔܥ͡Όͳ͍ͱ࢖͑ͳ͍ - ϥΠϑαΠΫϧͷ؅ཧ͕൥ࡶʹͳΔ (ಉظͱ͔) - ϝϞϦΊͬͪΌ৯͏৔߹͕͋Δ - Ωϟογϡ͕شൃͨ࣌͠ʹͲ͏͢Δͷ͔ʁ
  119. Pool & Flushύλʔϯ POSTϦΫΤετܥʹ࢖͏ɽ ϦΫΤετ͕དྷͨ࣌ʹΩϟογϡʹͦͷ಺༰ΛཷΊɼ ͋ΔλΠϛϯάͰӬଓετϨʔδʹॻ͖ग़͢

  120. Pool & Flushύλʔϯ Server Client Primary Storage ii iii Cache

    Storage i ii iii i. ϦΫΤετ ii. ΩϟογϡʹཷΊΔ iii. Ϩεϙϯε (͋ΔλΠϛϯάͰ) x. ӬଓετϨʔδʹॻ͖ग़͠ x
  121. Pool & Flushύλʔϯ Pros - ߴ଎ʹߋ৽ܥΛॲཧͰ͖Δ Cons - ϓʔϧ͕ͿͬյΕͨ࣌ʹσʔλ͕ফ໓͢Δ -

    σʔλͷҰ؏ੑΛอͭ࿑ྗ͕͔͔Δ
  122. ΫϥΠΞϯταΠυΩϟογϡ

  123. HTTP HeaderΛ༻͍ͨΩϟογϡ Server Client i ii i. ϦΫΤετ ii. ϔομ෇͚ͯฦ͢

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

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

    If-Modified-Since - If-None-Match ii. ৚݅ʹैͬͯฦ͢ contents contents ແବʹίϯςϯπΛฦ͢ඞཁ͕ແ͘ͳΔ
  126. ϩʔΧϧͷ؀ڥ಺Ͱ׬݁ͤ͞Δ - ΋͸΍ΩϟογϡͲ͜ΖͰ͸ͳ͍ - ྫ: - ӾཡཤྺΛΫϥΠΞϯτͰ࣋ͬͯ΋Β͏ - λΠϜϥΠϯ࣮૷ΛΫϥΠΞϯτͷετϨʔδʹ ࣋ͬͯ΋Β͏

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

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

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

    Thundering Herd ໰୊ (Kazuho@Cybozu Labs) http://labs.cybozu.co.jp/blog/kazuho/archives/2007/09/cache_and_thundering_herd.php ❞
  130. Cache Thundering Herd - ΤϯτϦ͝ͱʹExpireͷपظΛόϥ͢ͱ͔ - ಉҰ಺༰ͷΤϯτϦΛ2ॏʹ༻ҙ͓͍ͯͯ͠ɼ
 ͲͪΒ͔ҰํΛૣ͘ (΋͘͠͸஗͘) Expireͤ͞Δͱ͔

    ͦ͏͍͏ରࡦɾ޻෉͕ඞཁͱͳΔ
  131. ಉظ Ωϟογϡͷ಺༰ͱӬଓετϨʔδͷ಺༰ͷ
 ಉظͲ͏͢ΔΜ͡Ό໰୊

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  148. Ωϟογϡ͸ຑༀ

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

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

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

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

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

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

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

  156. ͪΌΜͱઃܭΛ͢Δ

  157. ͪΌΜͱઃܭΛ͢Δ - ͪΌΜͱDB (σʔλϞσϧ) ͷઃܭΛ͢Δ - ΠϯσοΫεͱ͔΋ؚΊͯ - มͳΞʔΩςΫνϟΛ΍ΊΔ -

    ϘτϧωοΫʹͳΓ͕ͪ - ʮ౰ͨΓલͷ͜ͱΛ౰ͨΓલʹ΍Δʯ
  158. Ͳ͏΍ͬͯ΋ΫΤϦ͕஗͍ Server Client Client . . . RDBMS Slow Query

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

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

    Slave Slave ΩϟογϡʹཔΒͣ SlaveΛฒ΂Δ΋Α͠
  161. ֎෦αʔϏεʹґଘ͍ͯ͠Δ Server Client Client . . . Outer Service Request

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

    (via HTTP) ֎෦αʔϏεʹґଘ͠ͳ͍ ํ๏Λߟ͑Δ
  163. ͪΌΜͱଌఆΛ͢Δ

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

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


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

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

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

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

  170. Q?

  171. ͕࣌ؒ͋Ε͹ͷίʔφʔ

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

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

    Πϯλʔωοτʹ͸ͳΜͰ΋͋Δ
  174. ΩϟογϡετϨʔδબఆ

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

    - ετϨʔδʹৄ͍͠ਓ͕͍Ε͹ྑ͍
  176. ΩϟογϡετϨʔδબఆ

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

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

    ຊ౰ʹ৑௕Խ͕ඞཁͳͷ͔Ͳ͏͔Λߟ͑Δ
 ඞཁ͸͋Δ