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

サーバレスアーキテクチャ入門

1fabfca5092bfe3f0712a0e66392f165?s=47 morihirok
February 13, 2018

 サーバレスアーキテクチャ入門

社内勉強会で話したときのスライドです。

1fabfca5092bfe3f0712a0e66392f165?s=128

morihirok

February 13, 2018
Tweet

Transcript

  1. αʔόϨε ΞʔΩςΫνϟ ೖ໳

  2. About Me • ৿߂ Ұໜ • Ruby / JavaScript(Node.js) /

    C • Ruby on Rails / Serverless / React.js
 ϏΞόογϡεϐʔΧʔେืूʂ
  3. αʔόϨε ΞʔΩςΫνϟ ͱ͸

  4. ࡶͳઆ໌ • AWS Lambda • Google Cloud Functions • Azure

    Functions • ͱ͔ͷFaaS(Function as a Service)Λ࢖͏
 ΞʔΩςΫνϟ
  5. FaaS ͱ͸

  6. αʔόͷߏஙɾ؅ཧΛඞཁͱ͠ͳ͍ Function࣮ߦ؀ڥ • ࣮ߦ͍ͨؔ͠਺(ίʔυ)Λ഑ஔ͢Ε͹ɺ࣮ߦ͸ Ϋϥ΢υαʔϏεଆ͕Α͠ͳʹ΍ͬͯ͘ΕΔ • ࣮ߦྔɾ࣮ߦ࣌ؒʹԠͨ͡՝ۚํࣜ • ༷ʑͳΠϕϯτΛτϦΨʔͱͯؔ͠਺Λ࣮ߦ ͢Δ͜ͱ͕Ͱ͖Δ

  7. ैདྷͷWebΞϓϦέʔγϣϯͩͱ… • αʔό͕ॲཧՄೳ͔؂ࢹ͢Δඞཁ͕͋Δ • ٸͳτϥϑΟοΫ૿େͰམͪΔةݥ͕͋Δ
 (ώϧφϯσε๒ɺ೥຤೥࢝etc…) • ༧૝࠷େτϥϑΟοΫʹ߹ΘͤͯαʔόΛௐ ୡ͢Δͱɺ௨ৗ࣌τϥϑΟοΫ࣌ʹίεύ͕ ѱ͘ͳΔ

  8. FaaSΛ࢖͏ͱ… • αʔό؂ࢹͷඞཁ͕ͳ͘ͳΔ • ٸͳτϥϑΟοΫ͕͖ͯ΋Ϋϥ΢υαʔϏε ͕શ෦ద੾ʹ͞͹͍ͯ͘ΕΔ • ࢖༻෼ͷίετ͔͔͔͠Βͳ͍ͷͰαʔόΛ ϑϧͰௐୡ͢ΔΑΓ҆͘ͳΔ৔߹͕ଟ͍

  9. ࣮ࡍʹಈ͍ͯͨΓ ։ൃͯ͠Δը໘ΛݟΔͷ͕ ૣ͍Ͱ͢

  10. σϞΞϓϦ֓ཁ • S3(Ϋϥ΢υετϨʔδ)͔ΒΞηοτ͕഑৴͞ΕΔ • API ܦ༝ͰLambda͕࣮ߦ͞ΕɺAWS͕࣋ͭϑϧϚ ωʔδυͳαʔϏε(Web APIܦ༝Ͱݺͼग़ͤΔαʔ Ϗε)Ͱ͋ΔDynamo DBʹσʔλΛอଘ͢Δ

    • Dynamo DB΁ͷอଘΛτϦΨʔͱͯ͠LambdaΛ࣮ ߦͤ͞ɺอଘ಺༰ΛSlackʹ௨஌͢Δ
  11. σϞΞϓϦ֓ཁ

  12. σϞΞϓϦ͕ैདྷͷΞϓϦߏ੒ͩͬͨ৔߹ !3FTU$POUSPMMFS DMBTTDPOUSPMMFS\ !3FRVFTU.BQQJOH tDSFBUFu  QVCMJDWPJEDSFBUF 3FRSFR \ 4USJOHNTHSFRNTH

     j ᬊᅊ j %ZOBNPECOFX%ZOBNP  ECTBWF JUFN  j ᬊᅊ j 4MBDLTMBDLOFX4MBDL4FSWJDF  TMBDLQPTU JUFN  ^ ^ DMBTT4MBDL4FSWJDF\ QVCMJDWPJEQPTU 4USJOHNTH \ 1PTUUP4MBDL ^ ^ DMBTT%ZOBNP\ QVCMJDWPJETBWF 4USJOHNTH \ 4BWFUP%# ^ ^
  13. ʮSlack௨஌͔Βϝʔϧૹ৴ʹ͠Α͏ʂʯ ͱ͍͏࢓༷มߋ͕ೖΔͱ… !3FTU$POUSPMMFS DMBTTDPOUSPMMFS\ !3FRVFTU.BQQJOH tDSFBUFu  QVCMJDWPJEDSFBUF 3FRSFR \

    4USJOHNTHSFRNTH  j ᬊᅊ j %ZOBNPECOFX%ZOBNP  ECTBWF JUFN  j ᬊᅊ j 4MBDL͝ΛϦ⑲ϰͽม๞ .BJMNBJMOFX.BJM4FSWJDF  NBJMQPTU JUFN  ^ DMBTT.BJM4FSWJDF\ QVCMJDWPJEQPTU 4USJOHNTH \ 4FOEBONBJM ^ ^ DMBTT%ZOBNP\ QVCMJDWPJETBWF 4USJOHNTH \ 4BWFUP%# ^ ^ NBJM
  14. !3FTU$POUSPMMFS DMBTTDPOUSPMMFS\ !3FRVFTU.BQQJOH tDSFBUFu  QVCMJDWPJEDSFBUF 3FRSFR \ 4USJOHNTHSFRNTH 

    ϕϯό⑲μϬϸ ᳔ό⑲τξύΧରԠ %ZOBNPECOFX%ZOBNP  ECTBWF JUFN  έϮ⑲ϔϸώϯϸε ͔ΞΔͩͱ͖ ͥΞΔͩͱ͖ 4MBDL͝ΛϦ⑲ϰͽม๞ .BJMNBJMOFX.BJM4FSWJDF  NBJMQPTU JUFN  ^ DMBTT.BJM4FSWJDF\ QVCMJDWPJEQPTU 4USJOHNTH \ 4FOEBONBJM ^ ^ DMBTT%ZOBNP\ QVCMJDWPJETBWF 4USJOHNTH \ 4BWFUP%# ^ ^ NBJM ʮSlack௨஌͔Βϝʔϧૹ৴ʹ͠Α͏ʂʯ ͱ͍͏࢓༷มߋ͕ೖΔͱ… ਏ͍ະདྷ͕ ݟ͑ͯ͘Δʜ
  15. σϞΞϓϦͷߏ੒Ͱ࢓༷มߋ͕ೖͬͨ৔߹ NBJM

  16. σϞΞϓϦͷߏ੒Ͱ࢓༷มߋ͕ೖͬͨ৔߹ NBJM ͜͜Λมߋ͢ΔͷΈʂ

  17. σϞΞϓϦͷߏ੒Ͱ࢓༷มߋ͕ೖͬͨ৔߹ • ϩάͷग़ྗΛLambdaͷ࣮ߦΠϕϯτʹ͢Δͱ Ξϥʔτܥͷ࣮૷͕͠΍ͦ͢͏ • όϦσʔγϣϯॲཧ΋API GatewayΛ࣮ߦΠϕ ϯτʹ͢Δ͜ͱͰରԠͰ͖ͦ͏ • ଞσʔλετΞରԠ΋Dynamo

    DB΁ͷอଘΛ ࣮ߦΠϕϯτʹ͢Ε͹Αͦ͞͏
  18. ΠϕϯτۦಈͰ ૄ݁߹͔ͭ αʔό؅ཧ͕ෆཁͳ ΞʔΩςΫνϟ

  19. αʔόϨε ΞʔΩςΫνϟ

  20. ֤ʑͷػೳ͸ Πϕϯτ͔Web APIΛܦ༝ͯ͠ ࣮ߦ͞ΕΔͷΈ

  21. ϚΠΫϩαʔϏεͷ ࣮ݱ

  22. ಋೖࣄྫ • υϥΰϯΫΤετX 
 (גࣜձࣾεΫΤΞɾΤχοΫε) • ೔ܦిࢠ൛
 (גࣜձࣾ ೔ຊܦࡁ৽ฉࣾ)
 


    ࢀߟ: https://aws.amazon.com/jp/solutions/case-studies/
  23. σϝϦοτ • ࣮ߦϥϯλΠϜ͕ݶΒΕΔ • Node.js, Python, C#, Java, Go(2018/2ݱࡏ) •

    ࢥ͍͖ͬΓϕϯμʔϩοΫΠϯ͢Δ • αʔυύʔςΟʔ੡ͷOSS͕֤Ϋϥ΢υαʔ ϏεͷࠩҟΛٵऩͯ͘͠Εͳ͍͔ͳ͊
  24. σϝϦοτ • ֶशίετ͸݁ߏߴ͍ • Πϕϯτۦಈͱ͍͏ߟ͑ํ • ϚΠΫϩαʔϏε΁ͷ଄ܮ • ֤Ϋϥ΢υαʔϏεͷ஌ࣝ

  25. σϝϦοτ ʮαʔόϨεͬͯαʔό؂ࢹ͠ͳ͍͍ͯ͘ΜͰ͠ΐʁʯ 
 ʮͱΓ͋͑ͣDB͸طଘͷRDBMS࢖͓͏ʯ 
 ʮEC2Λϥούʔͱͯ͠ஔ͍ͱ͚͹͍͍Μ͡Όͳ͍ʁʯ 
 ↑่յͷংষ

  26. ੋඇࢼͯ͠Έ͍ͯͩ͘͞