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

Scalable WordPress - より多くのアクセスを捌けるWordPressサイトの作り方

Hidetaka Okamoto
August 04, 2018
220

Scalable WordPress - より多くのアクセスを捌けるWordPressサイトの作り方

WordBench倉敷 2018/08

Hidetaka Okamoto

August 04, 2018
Tweet

More Decks by Hidetaka Okamoto

Transcript

  1. S c a l a b l e Wo rd

    P re s s Α Γ ଟ ͘ͷ ΞΫ η ε Λ ࡹ ͚Δ Wo rd P re s s αΠ τ ͷ ࡞ Γ ํ Wo rd B e n c h ૔ ෑ 2 0 1 8 / 0 8
  2. H i d e t a k a O k

    a m o t o • Digitalcube Co. Ltd. • WordCamp Kyoto 2017࣮ߦҕһ௕ • GutenbergίΞίϯτϦϏϡʔλʔ
  3. A M I M O T O ͷ ձ ࣾ

    https://ja.amimoto-ami.com
  4. S h i f t e r : ੩ త

    W P αΠ τ ϗ ε ςΟ ϯ ά https://getshifter.io
  5. H T T P 5 0 3 S e r

    v i c e U n a v a i l a b l e
  6. H T T P 5 0 3 S e r

    v i c e U n a v a i l a b l e • ʮαʔϏεར༻ෆՄʯʮαʔϏε͕ར༻Ͱ͖·ͤΜʯ • ౰֘΢ΣϒαΠτʹॠؒతʹଟ਺ͷΞΫηε͕ͳ͞Εɺαʔόʔ͕ॲ ཧෆೳʹؕͬͨɻ • αʔόʔ͕ϝϯςφϯεதͳͲͰػೳ͍ͯ͠ͳ͔ͬͨɻ • αʔό಺ͷ࠷େσʔλసૹྔΛ௒աͨ͠ɻ • ಉҰαʔό಺ͷଞͷαΠτ΁ͷΞΫηεͷूதɻ https://ja.wikipedia.org/wiki/HTTP_503
  7. H T T P 5 0 3 S e r

    v i c e U n a v a i l a b l e • ʮαʔϏεར༻ෆՄʯʮαʔϏε͕ར༻Ͱ͖·ͤΜʯ • ౰֘΢ΣϒαΠτʹॠؒతʹଟ਺ͷΞΫηε͕ͳ͞Εɺαʔόʔ͕ॲ ཧෆೳʹؕͬͨɻ • αʔόʔ͕ϝϯςφϯεதͳͲͰػೳ͍ͯ͠ͳ͔ͬͨɻ • αʔό಺ͷ࠷େσʔλసૹྔΛ௒աͨ͠ɻ • ಉҰαʔό಺ͷଞͷαΠτ΁ͷΞΫηεͷूதɻ https://ja.wikipedia.org/wiki/HTTP_503
  8. H T T P 5 0 3 ͷ ͓ ͞

    Β ͍ • ʮαʔϏεར༻ෆՄʯʮαʔϏε͕ར༻Ͱ͖·ͤΜʯ • ౰֘΢ΣϒαΠτʹॠؒతʹଟ਺ͷΞΫηε͕ͳ͞Εɺαʔόʔ͕ॲ ཧෆೳʹؕͬͨɻ • αʔόʔ͕ϝϯςφϯεதͳͲͰػೳ͍ͯ͠ͳ͔ͬͨɻ • αʔό಺ͷ࠷େσʔλసૹྔΛ௒աͨ͠ɻ • ಉҰαʔό಺ͷଞͷαΠτ΁ͷΞΫηεͷूதɻ https://ja.wikipedia.org/wiki/HTTP_503
  9. Α ͘ ͋ Δ ෛ ՙ ର ࡦ • αʔόʔΛڧ͘͢Δ

    • ΩϟογϡΛ࢖͏ • CDNΛ࢖͏ • ෳࡶͳॲཧΛݮΒ͢ • ੩తԽ͢Δ
  10. ༨ ஊ ɿ ͳ ͥ Ω ϟ ο γ ϡ

    ϓ ϥ άΠ ϯ Λ ࢖ ͏ ͷ ͔ ʁ
  11. ༨ ஊ ɿ ͳ ͥ Ω ϟ ο γ ϡ

    ϓ ϥ άΠ ϯ Λ ࢖ ͏ ͷ ͔ ʁ • WP(PHP)͸ຖճDB৘ใ͔ΒHTMLΛ૊ΈཱͯΔ࡞ۀΛ͍ͯ͠Δ • ʮಉ͡΋ͷΛຖճ૊ΉͳΒɺͲ͔͜ʹอଘ͠ͱ͜͏ͥʯ • ૊ΈཱͯͨHTMLΛอଘͯ͠ɺͦΕΛදࣔͤ͞Δ • DB઀ଓ΍૊Έཱͯ࡞ۀ͕ݮΔͷͰෛՙ͕গͳ͘ͳΔ
  12. ͳ ͥ Ω ϟ ο γ ϡ ϓ ϥ άΠ

    ϯ Ͱ ࠔ Δ ਓ ͕ Ͱ Δ ͷ ͔ • ʮಉ͡΋ͷΛຖճ૊ΉͳΒɺͲ͔͜ʹอଘ͠ͱ͜͏ͥʯˡ ͜Ε • อଘͨ͠ޙʹσʔλΛมߋͨ͠ΒͲ͏ͳΔʁ • อଘ͞ΕͨϑΝΠϧ͕ফ͑ͨΒͲ͏ͳΔʁ • ͦ΋ͦ΋ͦͷσʔλ͸อଘͯ͠େৎ෉ͳ΋ͷͳͷʁ • ಉ͜͡ͱͯ͠ΔϓϥάΠϯ͕ଞʹ΋ͳ͍ʁ
  13. α ʔόʔ ձ ࣾ Ͱ Ω ϟ ο γ ϡ

    Λ ࢖ ͬͯ Δ ৔ ߹ ΋ ͋ Δ https://support.amimoto-ami.com/೔ຊޠ/αʔϏεશൠʹ͍ͭͯ/ਪ঑͞Εͳ͍ϓϥάΠϯ͸͋Γ·͔͢
  14. Α ͘ ͋ Δ ෛ ՙ ର ࡦ • αʔόʔΛڧ͘͢Δ

    • ΩϟογϡΛ࢖͏ • CDNΛ࢖͏ • ෳࡶͳॲཧΛݮΒ͢ • ੩తԽ͢Δ
  15. C D N ͱ Ω ϟ ο γ ϡ ͸

    ҧ ͏ ΋ ͷ ʁ • Ωϟογϡͨ͠HTMLΛฦ͢ͱ͍͏࢓૊Έ͸ಉ͡ • ϓϥάΠϯͷΩϟογϡ͸(େମ)WPαʔόʔ಺Ͱॲཧ͞ΕΔ • CDNαʔόʔʢΤοδαʔόʔʣͰॲཧ͢Δͷ͕CDN • αʔόʔ͕ผͳͷͰɺෛՙͷ෼ࢄʹ΋ͳΔ
  16. A W S C l o u d F ro

    n t ͷ Ω ϟ ο γ ϡ ૢ ࡞ ϓ ϥ άΠ ϯ https://wordpress.org/plugins/c3-cloudfront-clear-cache/
  17. ϝ σΟΞ ͩ ͚ ͳ Β J e t p

    a c k C D N ͱ ͍ ͏ ख ΋ https://ja.jetpack.com/features/
  18. Α ͘ ͋ Δ ෛ ՙ ର ࡦ • αʔόʔΛڧ͘͢Δ

    • ΩϟογϡΛ࢖͏ • CDNΛ࢖͏ • ෳࡶͳॲཧΛݮΒ͢ • ੩తԽ͢Δ
  19. ॲ ཧ ͢ Δ ͜ ͱ ͕ ଟ ͍ ͱ

    α ʔόʔ ΋ ͭ Β ͘ ͳΔ
  20. ݟ ௚ ͠ ͨ ํ ͕ Α ͍ ͔ ΋

    ͠ Ε ͳ ͍ ॲ ཧ • ΧελϜϑΟʔϧυͷ಺༰Λ࢖ͬͨෳࡶͳݕࡧॲཧ • ΞΫηε਺ΛWordPress಺Ͱॲཧͯ͠ϥϯΩϯά෇͚ • Ωϟογϡ͢ΔͱΑΖ͘͠ͳ͍σʔλΛ࢖͏ॲཧ (cookieͳͲ) • WarningͳͲͷϩά৘ใΛେྔʹ࢒͍ͯ͠Δ΋ͷ
  21. $ w p p ro f i l e Ͱ

    ύ ϑ Υ ʔϚ ϯε ௐ ࠪ https://developer.wordpress.org/cli/commands/profile/
  22. A P M ͳ Ͳ Ͱ Ϙ τϧ ω ο

    Ϋ ͷ ؂ ࢹ / ௐ ࠪ https://newrelic.degica.com/blog/2017-10-10-wordpress-performance-bottlenecks-kinsta
  23. Α ͘ ͋ Δ ෛ ՙ ର ࡦ • αʔόʔΛڧ͘͢Δ

    • ΩϟογϡΛ࢖͏ • CDNΛ࢖͏ • ෳࡶͳॲཧΛݮΒ͢ • ੩తԽ͢Δ
  24. H T M L ͩ ͚ ϗ ε τ ʹ

    ͢ Δ ͱ ݁ ߏ ڧ ͍ http://fukuyuki.net/post-805/
  25. u t s u s e m i : ࢦ

    ఆ ͠ ͨ αΠ τ Λ H T M L ʹ ม ׵ ͢ Δ O S S https://github.com/k1LoW/utsusemi
  26. w p s t a t i c Ͱ ݕ

    ࡧ ͢ Δ ͱ ϓ ϥ άΠ ϯ ΋ https://ja.wordpress.org/plugins/search/wp+static/
  27. W P α ϙʔ τ ͷ ੩ త αΠ τδΣ

    ω Ϩ ʔ λ ʔ ΋ https://www.gatsbyjs.org/docs/wordpress-source-plugin-tutorial/
  28. S h i f t e r : ੩ త

    W P αΠ τ ϗ ε ςΟ ϯ ά https://getshifter.io
  29. W P αΠ τ Λ H T M L ʹ

    ม ׵ ͯ͠ ެ ։ https://getshifter.io
  30. ੩ త Խ ͢ Δ ࡍ ͷ ஫ ҙ ఺

    • ΋ͪΖΜPHP΍MySQL͸࢖͑·ͤΜ • ϑΥʔϜ΍ݕࡧ͸֎෦αʔϏεͱ࿈ܞͯ͠࢖͏ • ม׵ॲཧ͕ඞཁͳͷͰɺߋ৽ͱެ։ʹ͢͜͠ϥά͕ग़Δ • ͱ͍͔ͦΕMovab…
  31. ੩ త Խ ͢ Δ ϝ Ϧ ο τ •

    Netlify΍S3ʹHTMLΛ͓͚͹མͪΔ͜ͱ͸΄΅ͳ͘ͳΔ • WPΛඇެ։ྖҬʹஔ͚͹߈ܸϦεΫΛݮΒͤΔ • ʮߋ৽͠ͳ͍࣌͸αʔόʔ͝ͱWPͳͤ͘͹ϝϯςল͚ΔͷͰ͸ʯ • ΠϕϯτɾاըαΠτͷӬ୅ڙཆʹΑ͘࢖ΘΕΔ
  32. J A W S D a y s 2 0

    1 8 https://jawsdays2018.jaws-ug.jp/
  33. ݟ ͨ ໨ ͱ ॲ ཧ Λ α ʔ όʔ

    ͝ ͱ ෼ ཭ ͢ Δ http://ossforum.jp/en/node/813
  34. ݟ ͨ ໨ ͱ ॲ ཧ Λ α ʔ όʔ

    ͝ ͱ ෼ ཭ ͢ Δ http://ossforum.jp/en/node/813 W P ͸ ͜ ͜ ͕ ಉ ͡ α ʔόʔ ͷ ͜ ͱ ͕ ଟ ͍
  35. ྫ ɿ ݟ ͨ ໨ ͱ ॲ ཧ Λ α

    ʔ όʔ ͝ ͱ ෼ ཭ ͢ Δ https://www.ustwo.com/
  36. u s t w o . c o m ͷ

    Π ϯ ϑ ϥ ߏ ੒ https://github.com/ustwo/ustwo.com-frontend
  37. ͏ ͪ ͷ α Π τ ΋ ΍ ͬͯΈ ͨ

    https://wp-kyoto.net/
  38. W P - a p p / D B F

    ro n t e n d
  39. P WA ४ ର Ԡ ͠ ͨ ͷ Ͱ Φ

    ϑ ϥ Π ϯ Ͱ ΋ ؍ Ε Δ https://wp-kyoto.net
  40. ϑ ϩ ϯ τ Τ ϯ υ ͱ ό ο

    Ϋ Τ ϯ υ ͷ ෼ ཭ • HTMLͷඳըΛSPAʹ·͔ͤΔʢσʔλ͸APIܦ༝ʣ • JSͰ΍Γ͍ͨ์୊ΞϓϦϥΠΫͳભҠ΍ඳը͕Ͱ͖Δ • Ionic / RN΍PWAରԠͳͲͰΞϓϦͱͯ͠΋ఏڙͰ͖Δ • WP͕APIॲཧͱ؅ཧը໘ૢ࡞͚ͩʹͳΔͷͰෛՙ͕ݮΔ • ΢ΟδΣοτʁϝχϡʔʁ஌Βͳ͍ࢠͰ͢Ͷ
  41. Tw e l v e F a c t o

    r A p p https://12factor.net/ja/
  42. Ұ ෦ D N S α ʔ Ϗ ε ʹ

    ͸ ϔ ϧε ν Σ ο Ϋ ͕ ͋ Δ
  43. ͭ ͳ ͕ Β ͳ ͘ ͳ ͬ ͨ Β

    ผ ͷ I P ΁ ྲྀ ͢
  44. α ʔόʔ ͕ མ ͪ ͨ Β ੩ త H

    T M L ʹ ΞΫ η ε Λ ྲྀ ͢
  45. ੩ త H T M L Ͱ ϑΣ Πϧ Φ

    ʔ όʔ • ʮਅͬനͰԿ΋ݟ͑ͳ͍ʯͱ͍͏ঢ়ଶ͸ճආͰ͖Δ • ΋ͪΖΜݕࡧ΍ձһɾ௨ൢػೳͳͲ͸࢖͑ͳ͍ • JS͸ಈ͘ͷͰɺGoogle޿ࠂͳͲ͸දࣔ͞ΕΔ • Ұ෦ΛఘΊͯͰ΋ɺ࠷ѱΛճආ͢Δͱ͍͏ରࡦ
  46. ͦ ͷ ଞ A W S + W P Ͱ

    Ͱ ͖ Δ ͍ Ζ Μ ͳ ࿩ https://speakerdeck.com/shogomuranushi/wordcamp-osaka-2018
  47. α ʔ όʔ ྉ ۚ ͸ අ ༻ Ͱ ͢

    ͔ ʁ ౤ ࢿ Ͱ ͢ ͔ ʁ • ڱ͍εϖʔεͩͱଟ͘ͷਓ͸ೖΒͳ͍ɺ͚Ͳ΋අ༻͸͍҆ • େ੎ͷ͓٬Λड͚ೖΕ͍͓ͨళ͸޿͍ςφϯτ΍౔஍Λܖ໿͢Δ • αʔόʔͩͬͯɺ͍҆ͷʹ͸ཧ༝͕͋Δʢ੍ݶɾύϑΥʔϚϯε౳ʣ • ౔஍ɾςφϯτΑΓαʔόʔ͸Ҿͬӽ͕͠؆୯ • ࢭ·ΔͱଘଓʹؔΘΔ΋ͷͳΒɺͪΌΜͱ౤ࢿ͠·͠ΐ͏