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
59
What is Serverless. Why is Serverless.
堀家隆宏
January 24, 2019
Tweet
Share
More Decks by 堀家隆宏
See All by 堀家隆宏
オープンソースコミュニティで加速するサーバーレスの未来/serverless will be
horike37
4
690
auth0-meetup.pdf
horike37
1
250
What’s happening with Serverless Framework, and it lives with AWS SAM.
horike37
0
77
aws-with-functional-saas
horike37
2
160
serverless-with-oss
horike37
0
100
slsconftokyo
horike37
0
5.3k
slsconfworkshop
horike37
3
2.5k
Test Driven Development For Lambda
horike37
2
290
serverless-kyoto
horike37
1
150
Other Decks in Programming
See All in Programming
From Subtype Polymorphism To Typeclass-based Ad hoc Polymorphism- An Example
philipschwarz
PRO
0
160
Outline View in SwiftUI
1024jp
1
100
Piniaの現状と今後
waka292
5
1.4k
go.mod、DockerfileやCI設定に分散しがちなGoのバージョンをまとめて管理する / Go Connect #3
arthur1
10
2.3k
GitHub Actionsのキャッシュと手を挙げることの大切さとそれに必要なこと
satoshi256kbyte
5
390
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
0
150
Realtime API 入門
riofujimon
0
100
macOS でできる リアルタイム動画像処理
biacco42
4
1.6k
プロジェクト新規参入者のリードタイム短縮の観点から見る、品質の高いコードとアーキテクチャを保つメリット
d_endo
1
1k
JaSST 24 九州:ワークショップ(は除く)実践!マインドマップを活用したソフトウェアテスト+活用事例
satohiroyuki
0
260
僕がつくった48個のWebサービス達
yusukebe
18
17k
組織に自動テストを書く文化を根付かせる戦略(2024秋版) / Building Automated Test Culture 2024 Autumn Edition
twada
PRO
10
4.5k
Featured
See All Featured
Documentation Writing (for coders)
carmenintech
65
4.4k
Code Reviewing Like a Champion
maltzj
519
39k
Become a Pro
speakerdeck
PRO
24
5k
Mobile First: as difficult as doing things right
swwweet
222
8.9k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
6.9k
Measuring & Analyzing Core Web Vitals
bluesmoon
1
39
Why You Should Never Use an ORM
jnunemaker
PRO
53
9k
Unsuck your backbone
ammeep
668
57k
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
159
15k
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