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

What is Serverless. Why is Serverless.

What is Serverless. Why is Serverless.

堀家隆宏

January 24, 2019
Tweet

More Decks by 堀家隆宏

Other Decks in Programming

Transcript

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

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

    Serverlessͱ͸Կ͔ʁ 2014೥ʹAWS Lambda͕ొ৔͠ɺΫϥ΢υͷΞʔΩςΫςΟϯάͷ෯͕ େ͖͘޿͕ͬͨɻ·ͨɺAPI Gateway΍Kinesis, AWS IoTͳͲͷొ৔ʹΑΓ Ϋϥ΢υͷ֎෦ͱͷσʔλ࿈ܞ͕༰қʹͳͬͨ
  3. • AWS Lambda, Azure Functions, Google Cloud Functionsͱ͍ͬͨΞϓϦέʔ γϣϯίʔυΛ࣮ߦͯ͘͠ΕΔαʔϏε •

    ঢ়ଶͷมԽʹΑΓΠϕϯτ͕ൃੜ͢Δ͜ͱͰίʔυ͕࣮ߦ͞ΕΔ • ಉ࣮࣌ߦ਺౳ͷ੍໿Լʹ͓͍ͯແݶʹεέʔϦϯά͢Δ(εέʔϦϯάͷࣄલ ༧ଌ͕ෆཁ) • ՝͕ۚίʔυͷ࣮ߦ࣌ؒ୯Ґ(ଟ͘ͷέʔεͰ͸҆͘ͳΔ) • ϛυϧ΢ΣΞͷΞοϓσʔτ͸ෆཁ(αʔό؅ཧ͔Βͷ։์) Function as a Service
  4. Kinesis Stream • େྔͷσʔλετϦʔϜΛϦΞϧλΠϜͰऩूͯ͠ɺॲཧΛͤ͞ΔͨΊͷα ʔϏε • ͨ͘͞ΜͷIoTσόΠεͷόοΫΤϯυͷड͚ޱͱͯ͠ར༻͞ΕΔέʔε͕ଟ ͍ • ड͚औͬͨσʔλ͸Batch

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

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

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

    جຊతʹґଘؔ܎͸ૄͰ͋ΓͭͭҰํ޲ʹू໿͞ΕΔͨΊɺ σʔλͷྲྀΕͷݟ௨͕͠ඇৗʹྑ͘ͳΔ Կ͕خ͍͠ͷ͔