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
AppSync를 활용한 리얼타임 서버리스 아키텍쳐
Search
Taewoo Kim
February 13, 2020
Programming
0
4.4k
AppSync를 활용한 리얼타임 서버리스 아키텍쳐
제21차 AWSKRUG 서버리스 소모임에서 발표한 내용입니다.
Taewoo Kim
February 13, 2020
Tweet
Share
More Decks by Taewoo Kim
See All by Taewoo Kim
AWS Lambda 내부동작 파헤치기
twkiiim
1
2.6k
Amazon VPC Deep Dive: ENI 를 알면 VPC 가 보인다
twkiiim
2
5.3k
온라인 주문 서비스를 서버리스 아키텍쳐로 구축하기
twkiiim
0
380
Amplify Meetup #01
twkiiim
1
6.3k
Amazon EventBridge vs Amazon SNS
twkiiim
0
2.1k
活用パターンで学ぶGraphQL
twkiiim
0
1.3k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
0
2k
AWS 기반 서버리스 아키텍쳐 톺아보기
twkiiim
1
2.9k
[LINE API × Tech API Vol. 2 Powered by AWS] サーバーレスでの分散トランザクション
twkiiim
0
2.3k
Other Decks in Programming
See All in Programming
42 best practices for Symfony, a decade later
tucksaun
1
180
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
0
110
今年一番支援させていただいたのは認証系サービスでした
satoshi256kbyte
1
250
LLM Supervised Fine-tuningの理論と実践
datanalyticslabo
3
1.1k
「Chatwork」Android版アプリを 支える単体テストの現在
okuzawats
0
180
testcontainers のススメ
sgash708
1
120
rails statsで大解剖 🔍 “B/43流” のRailsの育て方を歴史とともに振り返ります
shoheimitani
2
930
RWC 2024 DICOM & ISO/IEC 2022
m_seki
0
210
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
20年もののレガシープロダクトに 0からPHPStanを入れるまで / phpcon2024
hirobe1999
0
430
Stackless и stackful? Корутины и асинхронность в Go
lamodatech
0
700
Featured
See All Featured
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
44
9.3k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
6
510
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.2k
Faster Mobile Websites
deanohume
305
30k
Agile that works and the tools we love
rasmusluckow
328
21k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
170
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
127
18k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Building Flexible Design Systems
yeseniaperezcruz
327
38k
What's in a price? How to price your products and services
michaelherold
243
12k
Transcript
ӣక AppSync ܳ ഝਊೠ ܻఋ ࢲߡܻझ ইఃఫ
ߊ ࣗѐ • Solutions Architect, Classmethod (ੌࠄ) • Front-end, Back-end,
Android, iOS, Machine Learning, Computer Vision, etc • ୭Ӕ 1֙р AWS ࠙ঠীࢲ ޙࢿਸ ऺӝਤ೧ Ҋҵ࠙ై • Serverless on AWS, ؊ աইоࢲ Builder on AWS ܳ ೱೞݴ ழܻযܳ ऺח • য়ט ੑפ!!!! AWSKRUG ٜ࠙җ ݆݆ ҮܨೞҊ रणפ!!!!ƃƃ https://dev.classmethod.jp/author/kim-taewoo/ ೠҴয & ੌࠄয ӝࣿ࠶۽Ӓ
ࢲߡܻझ ইఃఫ ౠী ೧ рױ غযࠇद
ࢲߡܻझ ইఃఫ ౠ • ҙܻೡ ࢲߡо হ (NoOps) • ਃೡ
ٸ݃ ਃೠ ࠗ࠙݅ ਃೠ ݅ఀ ࢎਊೡ ࣻ • ஹೊ ܻࣗझח Lambda ( Fargate) • Lambda ҃ ਵ۽ connection ਸ ਬೡ ࣻ হ
Ӓۢ ࢲߡܻझ ইఃఫ۽ח ܻఋ ӝמ ޅ ݅٘աਃ?
ٜ݅ ࣻ ભ!
How? API Gateway ীࢲ ਢࣗ ਗ API Gateway websocket
How? PubSub ழ֏࣌ ӝ߈ ࣛܖ࣌ ইפ݅ PubSub ࣛܖ࣌ب (ੌױ) оמ
It’s possible, but … • ۿূ٘৬ ߔূ٘ р ాनਸ ਤೠ
Data structure ܳ ೧ঠೞҊ • োೞ݅ ؘఠܳ Ҋ ߉ਸ ٸ Validation ب ਃೞҊ • োೞ݅ ߔূ٘৬ ۿূ٘ নஏীࢲ ѐߊ ܖযઉঠೞҊ • ౠ ߔূ٘ ஏ ֢۱ (࢚) ݆ ٜযцפ High Availability .. Reliability .. Scalability ..
AppSync ܳ ࢎਊೞݶ ݽٚѪ рױ೧פ!!
AWS AppSync • Strong typing ਵ۽ ੋ೧ Validation ٘ (Ѣ)
ࢤۚ оמ (GraphQL ౠ) • ܻఋ ాनਸ ਤ೧ࢲ ߔূ٘ীࢲ ೧ঠೡ Ѫ Subscription ਸ झః݃ী ࢶ೧ فח Ѫ ߆ী হ • ۿূ٘ ஏীࢲח AppSync SDK ա Amplify ܳ ࢎਊೞݶ рױ Subscription оמ
ܻఋ ؘఠ ాनਸ ਤೠ AppSync ইఃఫ
AppSync ܻఋ ইఃఫ Micro services Subscription Data Streaming Mutation Trigger
݃۽ ࢲ࠺झ Stream ਵ۽ࠗఠ Lambda ܻѢ Subscription Micro services Subscription
Data Streaming Mutation Trigger AppSync ܻఋ ইఃఫ ࠗ࠙ য়ט ߊ ೨ब
ࢲߡܻझ झܻ߁ ইఃఫ
DynamoDB Streams → Lambda
DynamoDB Streams → Lambda • ഋੋ ࢲߡܻझ ؘఠ झܻ߁ ಁఢ
ೞա • Eventual Consistency Event-driven processing ١ਸ ܻೞӝী • ScalableɾReliableɾCost Effective • ߽۳بо ݒ ֫ সী ೧ࢲח पदрࢿਸ ࠁೞ ঋਵ۽ Kinesis DS о જ
RDS → DMS → Kinesis → Lambda
RDS → DMS → Kinesis → Lambda • RDS ܳ
ࢎਊೠ ҃ীب झܻ߁ ܻо оמೣ • Kinesis Data Streams ח ࢥ٘ܳ ஶ܀ ೡ ࣻ যঠ ೣ • Kinesis Data Streams ীࢲ Ҷ Lambda ۽ ো҅ೡ ਃח হ • Ӓ۞ա ࠄ ߊ ݾ (AppSync ো҅) ਸ ਤೠ ਊب۽ח Lambda ۽ ࠙ • DB (MySQL, PostgreSQL ١) ਵ۽ ࠗఠ Lambda ܳ प೯दఃח ߑߨب ઓ
ӝఋ ߮ ࣗझ
• SQS ীࢲ Lambda ۽ ো҅غח ಁఢ • Kinesis ীࢲ
Lambda ۽ ো҅غח ಁఢ • API Gateway ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Alarms ীࢲ Lambda ۽ ো҅غח ಁఢ • CloudWatch Events ীࢲ Lambda ۽ ো҅غח ಁఢ • Ӓ ৻ীب ޖࣻ ݆ ӝఋ ߮ ࣗझ
Lambda ۽ ؘఠܳ ߉ই৳ਵݶ рױೞભ!
Lambda → AppSync
ؘݽ ۽ં ইఃఫ
ؘݽ ইఃఫ Microservice DynamoDB Subscription द۽ ࢎਊೡ AppSyncਊ DB Mutation
DynamoDB Streams
Microservice • API Gateway → Lambda → DynamoDB ҳࢿ •
о ݆ ॳח ࢲߡܻझ ইఃఫ API ߔূ٘ ಁఢ • рױೠ ੑ۱ ಬਸ ܻೞח ࢲ࠺झܳ ۽ ٜয ؘݽ٘ ࢿ
AWS AppSync • AppSync ҳ୷दীח Serverless Framework ܳ ୶ୌ •
Subscription ܳ झః݃ী ୶оೞח Ѫ݅ਵ۽ ۄ ஏীࢲ Subscription оמ ( ߔূ٘ সߊࢤ X ) • ਃೠ ӝמ Mutation җ Subscription ࡺ݅, Query ܳ झః݃ী ١۾ೞ ঋਵݶ GraphQL झః݃ ী۞о غ۽ рױೠ ௪ܻ ೞաܳ ୶о೧ঠೣ (getOrder ࢿ) • Mutation ೞӝ ਤ೧ࢲ DynamoDB ܳ ؘఠ ࣗझ۽ࢲ ࢤࢿೞҊ, TTL (Time-To-Live) ܳ ࢸೠ. (expiresAt ܳ AWSTimestamp ఋੑਵ۽ ࢶೠ)
DynamoDB Streams → Lambda • DynamoDB Streams ח ୭ 24
दр ؘఠ ࠁઓ, ؘఠ ߸҃ ࣽߣ ࠁૐоמೠ ࢲ࠺झ • Ӓ۞ա ܻఋ ࢲ࠺झীࢲח ୭ 24दр ؘఠ ࠁઓ ߹ о হӟ פ. • ߽۳بܳ ֫۰ݶ ߓ ࢎૉܳ ઑೞݶ ؽ
Lambda → AppSync • पࢲ࠺झਊਵ۽ ܾܻૉػ AppSync Client SDK ח
javascript ߡ ࡺ (Amplify ܳ ӂ) • AppSync Client SDK ܳ Lambda ࢚ীࢲ زदఃӝ ਤ೧ࢲח ݻо • ismorphic-fetch ܳ ನ ೧ঠೣ • disableOffline ܳ true ۽ ߸҃೧ঠೣ
DEMO TIMEʂ
None
٘ܳ ೠߣ ಝࠅөਃ https://github.com/twkiiim/serverless-tutorials/tree/master/realtime-stream-with-appsync
AppSync Subscription ী ೞৈ
AppSync WebSockets MQTT over WebSockets WebSockets (NEW) Payload Size 128Kb
240Kb CloudWatch Metrics X O Selection Set Filtering X O Enhanced Connection Rates X O Enhanced Broadcast Rates X O https://aws.amazon.com/jp/blogs/mobile/appsync-realtime/
re:Invent 2019 Builders Fair ীࢲ ࣗѐػ Smart Chair
42
AppSync ী ೧ ؊ ঌҊ रݶ?
AppSync ҙ۲ ࠶۽Ӓ • AWS ੑޙ ࠶۽Ӓ – AppSync ಞ
(ೠҴয) https://dev.classmethod.jp/cloud/aws/aws-appsync-re-introduction-2019-korean-ver/
AppSync ҙ۲ ࠶۽Ӓ • [AppSync ѐ֛ܻ] AWS AppSync ߂ Resolver
Mapping Template ী ೧ ѐ֛ਸ ܻ೧ࠇद! https://dev.classmethod.jp/cloud/appsync-resolver-vtl-tutorial-ko/
AppSync ҙ۲ ࠶۽Ӓ • [AWS AppSync] ΤοδσόΠεͷσʔλΛ AWS IoTܦ༝Ͱऔಘͯ͠GraphQLΛߋ৽ͯ͠Έ·ͨ͠ɻ https://dev.classmethod.jp/cloud/aws-appsync-with-awsiot/
AppSync ҙ۲ ࠶۽Ӓ • [AWS AppSync] ΤοδσόΠεͷσʔλΛ AWS IoTܦ༝Ͱऔಘͯ͠GraphQLΛߋ৽ͯ͠Έ·ͨ͠ɻ https://dev.classmethod.jp/cloud/aws-appsync-with-awsiot/
AppSync ۽ ۠Ѫب غ ঋਸө?
State Management by AppSync • ࢲߡܻझ ইఃఫ ಁఢীࢲח Rich Client
ܳ ೱ • Ӓ۞ա ۿূ٘ ٘ ࠂبо աѱ ૐоೞחѪ જ ঋ • ۿূ٘ ٘ ࠂب ࢚ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ٘ ࠂبܳ AppSync Subscription ী ઓ ೧ࢲ ೧Ѿೡ ࣻب ঋਸө? • ֎ਕ ࣘب/উࢿ ١ী ઓࢿ ࢤӣ. • Ӓ۞ա 5G दীח ޙઁח হ ঋਸө?
State Management by AppSync • ࢲߡܻझ ইఃఫ ಁఢীࢲח Rich Client
ܳ ೱ • Ӓ۞ա ۿূ٘ ٘ ࠂبо աѱ ૐоೞחѪ જ ঋ • ۿূ٘ ٘ ࠂب ࢚ࠗ࠙ী ӝৈೞח State Management • State Management ܳ بੑೞӝ ਤೠ ٘ ࠂبܳ AppSync Subscription ী ઓ ೧ࢲ ೧Ѿೡ ࣻب ঋਸө? • ֎ਕ ࣘب/উࢿ ١ী ઓࢿ ࢤӣ. • Ӓ۞ա 5G दীח ޙઁח হ ঋਸө? Let’s discuss together!
хࢎפ