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

What is Serverless. Why is Serverless.

What is Serverless. Why is Serverless.

53c9bf20050e5457f054eac61c388a15?s=128

堀家隆宏

January 24, 2019
Tweet

Transcript

  1. What is Serverless Why is Serverless

  2. ࣗݾ঺հ ງՈོ޺ • Serverless Operations LLC • Serverless Framework Core

    mainainer • Serverless Step Functions, Serverless Atom Dashbord ։ൃऀ • Serverless Champion powerd by Serverless.inc
  3. Serverlessͱ͸Կ͔ ͦͷຊ࣭ʹ͍ͭͯ ղઆ͍͖ͯ͠·͢

  4. • ޿ٛͳҙຯͰ͍͏ͱαʔόʔ΍ίϯςφͷ؅ཧ͕ෆཁͳαʔϏεΛར༻ͨ͠ ΓɺͦΕΒΛ׆༻ͯ͠ΞϓϦέʔγϣϯΛͭͬͨ͘Γ͢Δߟ͑ํͱੈք؍ • ͜͜Ͱ͍͏Serverlessͱ͸ɺAWS LambdaͷΑ͏ͳFunction as a Serviceͱ ϚωʔδυαʔϏεͰߏ੒͞ΕͨγεςϜ΍ΞϓϦέʔγϣϯΛҙຯ͢Δ

    Serverlessͱ͸Կ͔ʁ 2014೥ʹAWS Lambda͕ొ৔͠ɺΫϥ΢υͷΞʔΩςΫςΟϯάͷ෯͕ େ͖͘޿͕ͬͨɻ·ͨɺAPI Gateway΍Kinesis, AWS IoTͳͲͷొ৔ʹΑΓ Ϋϥ΢υͷ֎෦ͱͷσʔλ࿈ܞ͕༰қʹͳͬͨ
  5. • αʔό΍ίϯςφͳͲͷΠϯϑϥετϥΫνϟΛ؅ཧ͢Δ࡞ۀ͔Β։์͞Ε Δ • ίετͷ࠷దԽɻଟ͘ͷ৔߹͸҆͘ͳΔ • Ϋϥ΢υͷ੍໿Լʹ͓͍ͯແݶͷεέʔϥϏϦςΟΛੜΉɻجຊతʹ͸ࣄલ ͷΩϟύγςΟ༧໿౳͸ෆཁ Serverlessͷ͍ΘΏΔϝϦοτ Ϋϥ΢υʹ͜ΕΒΛΞ΢τιʔε͢Δ͜ͱͰӡ༻ͰָΛ͢Δ

  6. Serverless Overview

  7. • AWS Lambda, Azure Functions, Google Cloud Functionsͱ͍ͬͨΞϓϦέʔ γϣϯίʔυΛ࣮ߦͯ͘͠ΕΔαʔϏε •

    ঢ়ଶͷมԽʹΑΓΠϕϯτ͕ൃੜ͢Δ͜ͱͰίʔυ͕࣮ߦ͞ΕΔ • ಉ࣮࣌ߦ਺౳ͷ੍໿Լʹ͓͍ͯແݶʹεέʔϦϯά͢Δ(εέʔϦϯάͷࣄલ ༧ଌ͕ෆཁ) • ՝͕ۚίʔυͷ࣮ߦ࣌ؒ୯Ґ(ଟ͘ͷέʔεͰ͸҆͘ͳΔ) • ϛυϧ΢ΣΞͷΞοϓσʔτ͸ෆཁ(αʔό؅ཧ͔Βͷ։์) Function as a Service
  8. • DynamoDB, API gateway, Auth0, Stripeͱ͍ͬͨػೳͷΈΛఏڙͯ͘͠ΕΔ αʔϏε • ServerlessͷੈքͰ͸͜ΕΒΛFaaSΛؔ਺ͱݺͿ͜ͱͱରൺͯ͠ϛυϧ΢Σ ΞͱݺΜͰΔ

    Functional SaaS / BaaS
  9. FaaSʹΑΔίʔυͷ࣮ߦ؀ڥͱ Functional SaaSʹΑΔػೳͷఏڙ γϯϓϧʹߟ͑Δͱ͜ͷ2ͭͷཁૉͰ ServerlessΞʔΩςΫνϟ͸੒Γཱͭ

  10. FaaSͷಛੑ

  11. ΠϕϯτυϦϒϯͰ͋Γ ඇৗறܕͰ͋Δ͜ͱΛ೦಄ʹஔ͍ͨ ϓϩάϥϛϯάϞσϧͱͳΔ

  12. • FaaSͷલஈʹ͋ΔαʔϏε্Ͱͷঢ়ଶͷมԽʹΑΓίʔυ͕࣮ߦ͞ΕΔ • PublisherͱSubscriberͱ͍͏ؔ܎ੑ • αʔόʔ্ͷมߋΛϙʔϦϯάͯ͠ݕ஌͢Δͷͱ͸ਅٯͷߟ͑ ΠϕϯτυϦϒϯͱ͸ putObject Event trigger

  13. • Πϕϯτ͕ൃੜͯ͠ίʔυ͕࣮ߦ͞ΕΔͱ͖ͷΈϓϩηε͕ଘࡏ͢Δ • ಥવϓϩηε͕མͪΔͱ͍͏͜ͱ͸ͳ͍ͨΊɺͦͷҙຯͰ͸ݎकͳγεςϜ ʹͰ͖Δ ඇৗறܕͱ͸

  14. • Πϕϯτ͕ൃੜͨ࣌͠ͷΈϓϩηεΛىಈͤ͞Ε͹ྑ͍ͷͰৗʹϓϩηεΛ ্ཱ͓ͪ͛ͯ͘ඞཁ͕ͳ͍ɻΠϕϯτυϦϒϯ͔ͩΒͦ͜ඇৗறͳϓϩηε ͷ࢓૊Έ͕੒Γཱͭ • ϓϩηε͕ৗʹଘࡏ͍ͯ͠ΔΘ͚Ͱ͸ͳ͍ͨΊɺFunction಺Ͱσʔλͷอ࣋ Λલఏͱ࣮ͨ͠૷͸Ͱ͖ͳ͍ɻͭ·ΓࣗવͱεςʔτϨεͳঢ়ଶͱͳΔɻ݁ ՌɺεςʔτΛ࣋ͨͳ͍͜ͱͰεέʔϥϏϦςΟΛ࣮ݱͰ͖Δ • Πϕϯτ͕ൃੜͨ࣌͠ͷΈϓϩηεΛىಈͤ͞Ε͹ྑ͍ͷͰɺ࣮ߦ࣌ؒʹͷ

    Έ՝ۚ͢Ε͹ྑ͍ͱ͍͏࠷దԽ͕੒Γཱͭ ΠϕϯτυϦϒϯͱඇৗற͕΋ ͨΒ͢ϝϦοτ ͜ΕΒͷ੍໿৚݅ʹΑΓFaaSͷϝϦοτ͕ ࠷େݶ׆͔ͤΔ࢓૊Έʹͳ͍ͬͯΔ
  15. Functional SaaSͷಛੑ

  16. ެࣜͷυΩϡϝϯτΛಡΜͰਖ਼͘͠ ཧղͷ্ͰɺదࡐదॴͰར༻͠ɺͦ ͷ੍໿৚݅ԼͰ࠷େݶͷੑೳΛҾ͖ ग़ͯ͠΍Δ͜ͱ͕େࣄ

  17. Kinesis Stream • େྔͷσʔλετϦʔϜΛϦΞϧλΠϜͰऩूͯ͠ɺॲཧΛͤ͞ΔͨΊͷα ʔϏε • ͨ͘͞ΜͷIoTσόΠεͷόοΫΤϯυͷड͚ޱͱͯ͠ར༻͞ΕΔέʔε͕ଟ ͍ • ड͚औͬͨσʔλ͸Batch

    sizeͷ୯ҐͰLambda͕ड͚औΓɺޙଓͷॲཧΛ࣮ ࢪ͢ΔɻKinesis಺Ͱγʔέϯεׂ͕ΓৼΒΕΔ͜ͱͰॱংอূ΋͋Δɻ௚ྻ ʹσʔλΛॲཧ͍ͤͨ࣌͞ʹKinesisΛڬΉ
  18. DynamoDB • ϚωʔδυܕͷNo SQLσʔλϕʔεɻେྔͷϫʔΫϩʔυͷσʔλΛӬଓ Խͤ͞Δͷʹ޲͍͍ͯΔ • Partition KeyʹΑΔ׬શҰகͱIndexʹΑΔ୳ࡧ͕Մೳ • ύϑΥʔϚϯεΛ࠷େʹͯ͠εϧʔϓοτίετΛ࠷খʹ͢ΔͨΊʹϓϥΫ

    ςΟεʹԊͬͨςʔϒϧઃܭ͕ඞཁͱͳΔ ɹɾΩʔͷϋογϡ஋ͰPartition͕෼ࢄ -> ۉ౳ʹͳΔΑ͏ͳΩʔઃܭ ɹɾεΩʔϚϨεDBɻεΩʔϚ͝ͱʹςʔϒϧΛ෼͚Δͱ͍͏ൃ૝͕ ɹɹͦ΋ͦ΋ͳ͍ɻΩϟύγςΟ؅ཧͷͨΊʹςʔϒϧ͸ΞϓϦέʔγϣϯ ɹɹͰ1ͭʹ͢Δ͜ͱ͕ཧ૝͸ཧ૝
  19. API Gateway • ։ൃऀ͕ API Λ࡞੒ɺ഑෍ɺอकɺ؂ࢹɺอޢͰ͖ΔαʔϏε • SPAͰWebΞϓϦέʔγϣϯΛ։ൃ͢Δ৔߹ͷόοΫΤϯυAPIͱͯ͠࢖Θ ΕΔέʔε͕Α͋͘Δ •

    جຊతʹ͸֎෦͔ΒͷೖྗͷೖΓޱͱͯ͠ɺ1ର1ͷؔ܎ੑͰσʔλΛѻ͏ɻ ೖྗνΣοΫ౳ͷલॲཧ͚ͩΛ࣮ࢪͯ͠ɺޙ͸SNS΍DynamoDBʹܨ͙͜ͱ ͰޙଓͷॲཧΛ࣮ࢪͤ͞Δ
  20. ΞʔΫςΫνϟͱͯ͠ͷಛੑ

  21. ΠϕϯτυϦϒϯΞʔΩςΫνϟ Service Function Service Function Function Event Event ΠϕϯτυϦϒϯͳϓϩάϥϛϯάϞσϧͱͳΔ͜ͱʹΑΓ ࣗવͱΠϕϯτ͕਺चͭͳ͗ʹ఻ൖ͍ͯ͘͠ΞʔΩςΫνϟͱͳΔ

    Service Service
  22. AWSͷαʔϏεʹஔ͖׵͑Δͱ ͜Μͳײ͡ API Gateway Lambda SNS DynamoDB

  23. ΠϕϯτυϦϒϯΞʔΩςΫνϟ Publisher Subscriber Event • جຊతʹ͸PublisherͱSubscriberؒͰϝοηʔδΛૹड৴͢Δؔ܎ੑ • Publisher͸ࣗ਎͕ૹ৴͢ΔΠϕϯτͷ͜ͱ͔͠஌Βͳ͍ • Subscriber͸ࣗ਎͕ͲͷΠϕϯτΛड͚औΔ͔͔͠஌Βͳ͍

    • ͜ΕʹΑΓγϯϓϧʹૄͷؔ܎ੑΛอͭ
  24. ΠϕϯτυϦϒϯΞʔΩςΫνϟ ͸Կ͕خ͍͠ͷ͔

  25. ΠϕϯτͷSubscriberͱPublisherͷؔ܎ੑΛมߋ͢Δ͜ͱͰ γϯϓϧʹػೳ௥Ճ΍มߋ͕࣮ݱͰ͖Δ Service Function Service Function Function Event Event ৽ػೳ

    Կ͕خ͍͠ͷ͔ ৽ػೳ
  26. Service Function Function Event Function Function Service Service Function Service

    جຊతʹґଘؔ܎͸ૄͰ͋ΓͭͭҰํ޲ʹू໿͞ΕΔͨΊɺ σʔλͷྲྀΕͷݟ௨͕͠ඇৗʹྑ͘ͳΔ Կ͕خ͍͠ͷ͔
  27. ֤αʔϏεͷ੍໿৚݅ԼͰ࣮૷Λߦ ͏͜ͱͰࣗવͱϚΠΫϩαʔϏεΞ ʔΫςΫνϟͷϝϦοτΛڗडͰ͖ ΔΑ͏ʹͳΔ

  28. ·ͱΊ

  29. ·ͱΊ • ServerlessΞʔΩςΫνϟ͸୯७ʹFaaSͱFunctional SaaSͷ૊Έ߹ΘͤͰ ͳΓ͍ͨͬͯΔ • FaaSͱFunctional SaaSͷ੍໿ࣄ߲Λਖ਼͘͠ཧղͯ͠దࡐదॴͰ࢖͏ɻ੍໿ ͸੍ݶͰ͸ͳ͍ɻͦͷ੍໿ʹै͏͜ͱͰ࠷େݶͷੑೳΛൃشͰ͖Δͱ͍͏͜ ͱ

    • ServerlessΞʔΩςΫνϟ͸ෳࡶͰ͸ͳ͍ɻΉ͠Ζมߋʹڧ͘σʔλͷྲྀΕ ͕෼͔Γ΍͘͢ͳΔɻϚΠΫϩαʔϏεͷϝϦοτΛਖ਼͘͠ڗडͰ͖Δ
  30. Thank You