Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
What is Serverless. Why is Serverless.
Search
堀家隆宏
January 24, 2019
Programming
1
60
What is Serverless. Why is Serverless.
堀家隆宏
January 24, 2019
Tweet
Share
More Decks by 堀家隆宏
See All by 堀家隆宏
オープンソースコミュニティで加速するサーバーレスの未来/serverless will be
horike37
4
700
auth0-meetup.pdf
horike37
1
250
What’s happening with Serverless Framework, and it lives with AWS SAM.
horike37
0
81
aws-with-functional-saas
horike37
2
160
serverless-with-oss
horike37
0
110
slsconftokyo
horike37
0
5.3k
slsconfworkshop
horike37
3
2.5k
Test Driven Development For Lambda
horike37
2
300
serverless-kyoto
horike37
1
160
Other Decks in Programming
See All in Programming
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
280
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
PHPとAPI Platformで作る本格的なWeb APIアプリケーション(入門編) / phpcon 2024 Intro to API Platform
ttskch
0
260
命名をリントする
chiroruxx
1
420
快速入門可觀測性
blueswen
0
380
今年のアップデートで振り返るCDKセキュリティのシフトレフト/2024-cdk-security-shift-left
tomoki10
0
210
責務を分離するための例外設計 - PHPカンファレンス 2024
kajitack
6
1.4k
nekko cloudにおけるProxmox VE利用事例
irumaru
3
430
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
140
MCP with Cloudflare Workers
yusukebe
2
220
rails stats で紐解く ANDPAD のイマを支える技術たち
andpad
1
290
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
Featured
See All Featured
How To Stay Up To Date on Web Technology
chriscoyier
789
250k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
The Cult of Friendly URLs
andyhume
78
6.1k
Building Applications with DynamoDB
mza
91
6.1k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
GraphQLの誤解/rethinking-graphql
sonatard
67
10k
The Invisible Side of Design
smashingmag
298
50k
Making Projects Easy
brettharned
116
5.9k
Unsuck your backbone
ammeep
669
57k
Building Adaptive Systems
keathley
38
2.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
59
3.6k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Transcript
What is Serverless Why is Serverless
ࣗݾհ ງՈོ • Serverless Operations LLC • Serverless Framework Core
mainainer • Serverless Step Functions, Serverless Atom Dashbord ։ൃऀ • Serverless Champion powerd by Serverless.inc
ServerlessͱԿ͔ ͦͷຊ࣭ʹ͍ͭͯ ղઆ͍͖ͯ͠·͢
• ٛͳҙຯͰ͍͏ͱαʔόʔίϯςφͷཧ͕ෆཁͳαʔϏεΛར༻ͨ͠ ΓɺͦΕΒΛ׆༻ͯ͠ΞϓϦέʔγϣϯΛͭͬͨ͘Γ͢Δߟ͑ํͱੈք؍ • ͜͜Ͱ͍͏ServerlessͱɺAWS LambdaͷΑ͏ͳFunction as a Serviceͱ ϚωʔδυαʔϏεͰߏ͞ΕͨγεςϜΞϓϦέʔγϣϯΛҙຯ͢Δ
ServerlessͱԿ͔ʁ 2014ʹAWS Lambda͕ొ͠ɺΫϥυͷΞʔΩςΫςΟϯάͷ෯͕ େ͖͕ͬͨ͘ɻ·ͨɺAPI GatewayKinesis, AWS IoTͳͲͷొʹΑΓ Ϋϥυͷ֎෦ͱͷσʔλ࿈ܞ͕༰қʹͳͬͨ
• αʔόίϯςφͳͲͷΠϯϑϥετϥΫνϟΛཧ͢Δ࡞ۀ͔Β։์͞Ε Δ • ίετͷ࠷దԽɻଟ͘ͷ߹҆͘ͳΔ • Ϋϥυͷ੍Լʹ͓͍ͯແݶͷεέʔϥϏϦςΟΛੜΉɻجຊతʹࣄલ ͷΩϟύγςΟ༧ෆཁ Serverlessͷ͍ΘΏΔϝϦοτ Ϋϥυʹ͜ΕΒΛΞτιʔε͢Δ͜ͱͰӡ༻ͰָΛ͢Δ
Serverless Overview
• AWS Lambda, Azure Functions, Google Cloud Functionsͱ͍ͬͨΞϓϦέʔ γϣϯίʔυΛ࣮ߦͯ͘͠ΕΔαʔϏε •
ঢ়ଶͷมԽʹΑΓΠϕϯτ͕ൃੜ͢Δ͜ͱͰίʔυ͕࣮ߦ͞ΕΔ • ಉ࣮࣌ߦͷ੍Լʹ͓͍ͯແݶʹεέʔϦϯά͢Δ(εέʔϦϯάͷࣄલ ༧ଌ͕ෆཁ) • ՝͕ۚίʔυͷ࣮ߦ࣌ؒ୯Ґ(ଟ͘ͷέʔεͰ҆͘ͳΔ) • ϛυϧΣΞͷΞοϓσʔτෆཁ(αʔόཧ͔Βͷ։์) Function as a Service
• DynamoDB, API gateway, Auth0, Stripeͱ͍ͬͨػೳͷΈΛఏڙͯ͘͠ΕΔ αʔϏε • ServerlessͷੈքͰ͜ΕΒΛFaaSΛؔͱݺͿ͜ͱͱରൺͯ͠ϛυϧΣ ΞͱݺΜͰΔ
Functional SaaS / BaaS
FaaSʹΑΔίʔυͷ࣮ߦڥͱ Functional SaaSʹΑΔػೳͷఏڙ γϯϓϧʹߟ͑Δͱ͜ͷ2ͭͷཁૉͰ ServerlessΞʔΩςΫνϟΓཱͭ
FaaSͷಛੑ
ΠϕϯτυϦϒϯͰ͋Γ ඇৗறܕͰ͋Δ͜ͱΛ೦಄ʹஔ͍ͨ ϓϩάϥϛϯάϞσϧͱͳΔ
• FaaSͷલஈʹ͋ΔαʔϏε্Ͱͷঢ়ଶͷมԽʹΑΓίʔυ͕࣮ߦ͞ΕΔ • PublisherͱSubscriberͱ͍͏ؔੑ • αʔόʔ্ͷมߋΛϙʔϦϯάͯ͠ݕ͢Δͷͱਅٯͷߟ͑ ΠϕϯτυϦϒϯͱ putObject Event trigger
• Πϕϯτ͕ൃੜͯ͠ίʔυ͕࣮ߦ͞ΕΔͱ͖ͷΈϓϩηε͕ଘࡏ͢Δ • ಥવϓϩηε͕མͪΔͱ͍͏͜ͱͳ͍ͨΊɺͦͷҙຯͰݎकͳγεςϜ ʹͰ͖Δ ඇৗறܕͱ
• Πϕϯτ͕ൃੜͨ࣌͠ͷΈϓϩηεΛىಈͤ͞Εྑ͍ͷͰৗʹϓϩηεΛ ্ཱ͓ͪ͛ͯ͘ඞཁ͕ͳ͍ɻΠϕϯτυϦϒϯ͔ͩΒͦ͜ඇৗறͳϓϩηε ͷΈ͕Γཱͭ • ϓϩηε͕ৗʹଘࡏ͍ͯ͠ΔΘ͚Ͱͳ͍ͨΊɺFunctionͰσʔλͷอ࣋ Λલఏͱ࣮ͨ͠Ͱ͖ͳ͍ɻͭ·ΓࣗવͱεςʔτϨεͳঢ়ଶͱͳΔɻ݁ ՌɺεςʔτΛ࣋ͨͳ͍͜ͱͰεέʔϥϏϦςΟΛ࣮ݱͰ͖Δ • Πϕϯτ͕ൃੜͨ࣌͠ͷΈϓϩηεΛىಈͤ͞Εྑ͍ͷͰɺ࣮ߦ࣌ؒʹͷ
Έ՝ۚ͢Εྑ͍ͱ͍͏࠷దԽ͕Γཱͭ ΠϕϯτυϦϒϯͱඇৗற͕ ͨΒ͢ϝϦοτ ͜ΕΒͷ੍݅ʹΑΓFaaSͷϝϦοτ͕ ࠷େݶ׆͔ͤΔΈʹͳ͍ͬͯΔ
Functional SaaSͷಛੑ
ެࣜͷυΩϡϝϯτΛಡΜͰਖ਼͘͠ ཧղͷ্ͰɺదࡐదॴͰར༻͠ɺͦ ͷ੍݅ԼͰ࠷େݶͷੑೳΛҾ͖ ग़ͯ͠Δ͜ͱ͕େࣄ
Kinesis Stream • େྔͷσʔλετϦʔϜΛϦΞϧλΠϜͰऩूͯ͠ɺॲཧΛͤ͞ΔͨΊͷα ʔϏε • ͨ͘͞ΜͷIoTσόΠεͷόοΫΤϯυͷड͚ޱͱͯ͠ར༻͞ΕΔέʔε͕ଟ ͍ • ड͚औͬͨσʔλBatch
sizeͷ୯ҐͰLambda͕ड͚औΓɺޙଓͷॲཧΛ࣮ ࢪ͢ΔɻKinesisͰγʔέϯεׂ͕ΓৼΒΕΔ͜ͱͰॱংอূ͋Δɻྻ ʹσʔλΛॲཧ͍ͤͨ࣌͞ʹKinesisΛڬΉ
DynamoDB • ϚωʔδυܕͷNo SQLσʔλϕʔεɻେྔͷϫʔΫϩʔυͷσʔλΛӬଓ Խͤ͞Δͷʹ͍͍ͯΔ • Partition KeyʹΑΔશҰகͱIndexʹΑΔ୳ࡧ͕Մೳ • ύϑΥʔϚϯεΛ࠷େʹͯ͠εϧʔϓοτίετΛ࠷খʹ͢ΔͨΊʹϓϥΫ
ςΟεʹԊͬͨςʔϒϧઃܭ͕ඞཁͱͳΔ ɹɾΩʔͷϋογϡͰPartition͕ࢄ -> ۉʹͳΔΑ͏ͳΩʔઃܭ ɹɾεΩʔϚϨεDBɻεΩʔϚ͝ͱʹςʔϒϧΛ͚Δͱ͍͏ൃ͕ ɹɹͦͦͳ͍ɻΩϟύγςΟཧͷͨΊʹςʔϒϧΞϓϦέʔγϣϯ ɹɹͰ1ͭʹ͢Δ͜ͱ͕ཧཧ
API Gateway • ։ൃऀ͕ API Λ࡞ɺɺอकɺࢹɺอޢͰ͖ΔαʔϏε • SPAͰWebΞϓϦέʔγϣϯΛ։ൃ͢Δ߹ͷόοΫΤϯυAPIͱͯ͠Θ ΕΔέʔε͕Α͋͘Δ •
جຊతʹ֎෦͔ΒͷೖྗͷೖΓޱͱͯ͠ɺ1ର1ͷؔੑͰσʔλΛѻ͏ɻ ೖྗνΣοΫͷલॲཧ͚ͩΛ࣮ࢪͯ͠ɺޙSNSDynamoDBʹܨ͙͜ͱ ͰޙଓͷॲཧΛ࣮ࢪͤ͞Δ
ΞʔΫςΫνϟͱͯ͠ͷಛੑ
ΠϕϯτυϦϒϯΞʔΩςΫνϟ Service Function Service Function Function Event Event ΠϕϯτυϦϒϯͳϓϩάϥϛϯάϞσϧͱͳΔ͜ͱʹΑΓ ࣗવͱΠϕϯτ͕चͭͳ͗ʹൖ͍ͯ͘͠ΞʔΩςΫνϟͱͳΔ
Service Service
AWSͷαʔϏεʹஔ͖͑Δͱ ͜Μͳײ͡ API Gateway Lambda SNS DynamoDB
ΠϕϯτυϦϒϯΞʔΩςΫνϟ Publisher Subscriber Event • جຊతʹPublisherͱSubscriberؒͰϝοηʔδΛૹड৴͢Δؔੑ • Publisher͕ࣗૹ৴͢ΔΠϕϯτͷ͜ͱ͔͠Βͳ͍ • Subscriber͕ࣗͲͷΠϕϯτΛड͚औΔ͔͔͠Βͳ͍
• ͜ΕʹΑΓγϯϓϧʹૄͷؔੑΛอͭ
ΠϕϯτυϦϒϯΞʔΩςΫνϟ Կ͕خ͍͠ͷ͔
ΠϕϯτͷSubscriberͱPublisherͷؔੑΛมߋ͢Δ͜ͱͰ γϯϓϧʹػೳՃมߋ͕࣮ݱͰ͖Δ Service Function Service Function Function Event Event ৽ػೳ
Կ͕خ͍͠ͷ͔ ৽ػೳ
Service Function Function Event Function Function Service Service Function Service
جຊతʹґଘؔૄͰ͋ΓͭͭҰํʹू͞ΕΔͨΊɺ σʔλͷྲྀΕͷݟ௨͕͠ඇৗʹྑ͘ͳΔ Կ͕خ͍͠ͷ͔
֤αʔϏεͷ੍݅ԼͰ࣮Λߦ ͏͜ͱͰࣗવͱϚΠΫϩαʔϏεΞ ʔΫςΫνϟͷϝϦοτΛڗडͰ͖ ΔΑ͏ʹͳΔ
·ͱΊ
·ͱΊ • ServerlessΞʔΩςΫνϟ୯७ʹFaaSͱFunctional SaaSͷΈ߹ΘͤͰ ͳΓ͍ͨͬͯΔ • FaaSͱFunctional SaaSͷ੍ࣄ߲Λਖ਼͘͠ཧղͯ͠దࡐదॴͰ͏ɻ੍ ੍ݶͰͳ͍ɻͦͷ੍ʹै͏͜ͱͰ࠷େݶͷੑೳΛൃشͰ͖Δͱ͍͏͜ ͱ
• ServerlessΞʔΩςΫνϟෳࡶͰͳ͍ɻΉ͠Ζมߋʹڧ͘σʔλͷྲྀΕ ͕͔Γ͘͢ͳΔɻϚΠΫϩαʔϏεͷϝϦοτΛਖ਼͘͠ڗडͰ͖Δ
Thank You