SlideShare uma empresa Scribd logo
1 de 39
© 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved.
Olivier Klein 奧樂凱
Emerging Technologies SA, Asia-Pacific
11 April 2017
Serverless Solutions
Build Scalable, Fault-Tolerant and Transaction-Safe Microservices on AWS
The Monolithic Architecture
The Monolithic Architecture - Antipattern
Difficult to scale
Single point of failure
Not fault-tolerant
Difficult to work across
teams, often slow to
iterate on new
functionalities
The Microservices Architecture
Microservices advocate creating a system
from a collection of small, isolated services,
each of which owns their data,
scalable and resilient to failure
Dr. Werner Vogels
CTO - Amazon
No server is easier to manage…
…than no server.
No server is easier to manage…
AWS Lambda
No server is easier to manage…
…than no server.
AWS Lambda
Run your code without thinking about
servers. Pay only for compute time
you consume.
Triggered through API calls or state
changes in your AWS environment
Scales automatically to match the
incoming event rate
Charged per 100ms execution time
AWS Lambda
The Microservices Architecture
Serverless Microservices
Architect to be Serverless
Fully Managed
• No provisioning
• Zero Administration
• High-Availability
Developer Productivity
• Focus on the code
• Innovate rapidly
• Reduce time to market
Scalability
• Automatically
• Scale up and down
Many Serverless Options on AWS
Storage DatabaseNetwork
Compute Content DeliveryMessaging and QueuesSecurity
Gateways
User Management Monitoring & Logging
Internet of Things
Machine Learning
Streaming Analytics
How to build application backends?
Back-end logic DatabaseMobile
How to build serverless microservices?
AWS
Lambda
Amazon API
Gateway
Amazon
DynamoDB
Microservice
Webhooks – Integrate with other platforms
Facebook
Page AWS Lambda
Slack
Channel
Amazon
API
Gateway
Amazon
DynamoDB
Incoming
Webhook
Oli just posted
on your page!
Oli | 2016-10-
01 | Hello
How to get the web app to the browser?
?
Storage and Delivery of the App
Amazon S3
Amazon
CloudFront
Amazon S3
• Highly available object storage
• Designed for 99.999999999% durability
• Offers HTTP / HTTPS endpoint to objects
Amazon CloudFront
• Content Delivery Network with 73 edge
locations across the world
• Caches content on edge locations for low
latency
Amazon S3
Amazon
CloudFrontBrowser
Serverless Game Demo
AWS
Lambda
Amazon API
Gateway
Amazon S3Amazon
CloudFront
Browser
Amazon
DynamoDB
DynamoDB
Streams
Cognito
Sync Trigger
S3 Event
Notification
AWS Lambda: Event-driven compute
You said transaction-safe!
How does that work?
Serverless Microservices
AWS
Lambda
Amazon API
Gateway
Highly available
Scalable
Fault tolerant
Cost effective
Secure
BUT: Stateless!
Microservice
?
Challenge: Centralized Database
user-svc account-svccart-svc
DB
Applications often have a
monolithic data store
• Difficult to make schema
changes
• Technology lock-in
• Vertical scaling
• Single point of failure
Centralized Database – Anti-pattern
Applications often have a
monolithic data store
• Difficult to make schema
changes
• Technology lock-in
• Vertical scaling
• Single point of failure
user-svc account-svccart-svc
DB
Decentralized Data Stores
account-svccart-svc
DynamoDB RDS
user-svc
ElastiCache RDS
Polyglot Persistence
Each service chooses its
data store technology
Low impact schema changes
Independent scalability
Data is gated through the
service API
CAP Theorem
It is impossible for a distributed computer system to
simultaneously provide all 3 of the following guarantees:
Consistency
Availability
Partition Tolerance
à In the presence of network partition we need to choose
between consistency and availability
Challenge: Transactional Integrity
Polyglot persistence generally translates
into eventual consistency
Asynchronous calls allow non-
blocking, but returns need to be handled
properly
How about transactional integrity?
• Event-sourcing – Capture changes as
sequence of events
• Staged commit
ERROR
STATE?
ROLLBACK?
Best Practice: Use Correlation IDs
09-02-2015 15:03:24 ui-svc INFO [uuid-123] ……
09-02-2015 15:03:25 catalog-svc INFO [uuid-123] ……
09-02-2015 15:03:26 checkout-svc ERROR [uuid-123] ……
09-02-2015 15:03:27 payment-svc INFO [uuid-123] ……
09-02-2015 15:03:27 shipping-svc INFO [uuid-123] ……
ui-svc
catalog-
svc
checkout-
svc
shipping-
svc
payment-
svc
request correlation id:
“uuid-123”
correlation id:
“uuid-123”
Best Practice: Microservice owns Rollback
Every microservice should expose
it’s own “rollback” method
This method could just rollback
changes, or trigger subsequent
actions (e.g. send notification)
If you implement staged commit,
also expose a commit function
Microservice
Function 1
Rollback
Commit
(optional)
Event-Driven: DynamoDB Streams
If async, consider event-driven
approach with DynamoDB Streams
Don’t need to manage function
execution failure, DDB Streams
automatically retries until successful
“Attach” yourself to the data of
interest
Kinesis, SQS, SNS also possible
Microservice
Challenge: Report Errors / Rollback
What if functions fail? (business logic
failure, not code failure)
Create a “Transaction Manager”
microservice that notifies all relevant
microservices to rollback or take action
DynamoDB is the trigger for the clean-up
function (could be SQS, Kinesis etc.)
Use Correlation ID to identify relations
mm-svc
Transaction
Manager
Function
DDB Streams
API Call
Error Table
Challenge: Report Errors / Rollback
ERROR
DynamoDB
Error Table
Transaction
Manager
Function
Kinesis
Error Stream
SQS
Error Queue
Rollback
(correlation-id)
Rollback
(correlation-id)
Rollback
(correlation-id)
Rollback
(correlation-id)
Challenge: Code Error
Lambda Execution Error because of
faulty / erroneous code
Leverage Cloudwatch Logs to
process error message and call
Transaction Manager
Set Cloudwatch Logs Metric Filter
to look for Error/Exception and call
Lambda Handler upon Alarm state
ui-svc
Cloudwatch
Logs
Cloudwatch
Alarm
Transaction
Manager
Function
Beware: Stream Model with AWS Lambda
DynamoDB Streams and Kinesis streams directly work
with AWS Lambda, however AWS Lambda needs to
acknowledge processing the message correctly
If Lambda fails to process the message, the stream
horizon will not be moved forward, creating a “jam”
Solution: Monitor AWS Lambda Error Cloudwatch
Metric and react when error rate of same “Correlation ID”
keeps increasing
MDM – Keep Data Consistent
Databases
AWS Lambda
“Cleanup”
Function
Cloudwatch
Scheduled Event
Perform Master Data Management
(MDM) to keep data consistent
Create AWS Lambda function to
check consistencies across
microservices and “cleanup”
Create Cloudwatch Event
to schedule the function
(e.g. hourly basis)
Final Thoughts
Use Amazon API Gateway to build a front-door to all your
microservices (AWS Lambda, Docker, EC2 etc.)
Use microservices with polyglot persistence to avoid
bottlenecks, schema issues, quick iterations and allow
independent scalability (and caching)
Create many version and stages – no additional charges
for APIs, allows for backwards compatibility
Use serverless interfaces when possible – HTML5 and
JS frameworks like React or Angular are useful
Thank you!
Olivier Klein 奧樂凱
Emerging Technologies SA, Asia-Pacific

Mais conteúdo relacionado

Mais procurados

Mais procurados (20)

AWS re:Invent 2016: Unlocking the Four Seasons of Migrations and Operations: ...
AWS re:Invent 2016: Unlocking the Four Seasons of Migrations and Operations: ...AWS re:Invent 2016: Unlocking the Four Seasons of Migrations and Operations: ...
AWS re:Invent 2016: Unlocking the Four Seasons of Migrations and Operations: ...
 
3 Secrets to Becoming a Cloud Security Superhero - Session Sponsored by Trend...
3 Secrets to Becoming a Cloud Security Superhero - Session Sponsored by Trend...3 Secrets to Becoming a Cloud Security Superhero - Session Sponsored by Trend...
3 Secrets to Becoming a Cloud Security Superhero - Session Sponsored by Trend...
 
Rethinking Your Migration Strategy to Your Competitive Advantage
Rethinking Your Migration Strategy to Your Competitive AdvantageRethinking Your Migration Strategy to Your Competitive Advantage
Rethinking Your Migration Strategy to Your Competitive Advantage
 
Architecting Application Services For Hybrid Cloud - AWS Summit SG 2017
Architecting Application Services For Hybrid Cloud - AWS Summit SG 2017Architecting Application Services For Hybrid Cloud - AWS Summit SG 2017
Architecting Application Services For Hybrid Cloud - AWS Summit SG 2017
 
Casi reali di Mass Migration nel Cloud: benefici tangibili ed intangibili
Casi reali di Mass Migration nel Cloud: benefici tangibili ed intangibiliCasi reali di Mass Migration nel Cloud: benefici tangibili ed intangibili
Casi reali di Mass Migration nel Cloud: benefici tangibili ed intangibili
 
New Achitectures
New AchitecturesNew Achitectures
New Achitectures
 
Security Best Practices_John Hildebrandt
Security Best Practices_John HildebrandtSecurity Best Practices_John Hildebrandt
Security Best Practices_John Hildebrandt
 
AWS re:Invent 2016: The Psychology of Security Automation (SAC307)
AWS re:Invent 2016: The Psychology of Security Automation (SAC307)AWS re:Invent 2016: The Psychology of Security Automation (SAC307)
AWS re:Invent 2016: The Psychology of Security Automation (SAC307)
 
Opening Keynote - AWS Summit SG 2017
Opening Keynote - AWS Summit SG 2017Opening Keynote - AWS Summit SG 2017
Opening Keynote - AWS Summit SG 2017
 
Keeping Developers and Auditors Happy in the Cloud
Keeping Developers and Auditors Happy in the CloudKeeping Developers and Auditors Happy in the Cloud
Keeping Developers and Auditors Happy in the Cloud
 
Governance @ Scale: Compliance Automation in AWS | AWS Public Sector Summit 2017
Governance @ Scale: Compliance Automation in AWS | AWS Public Sector Summit 2017Governance @ Scale: Compliance Automation in AWS | AWS Public Sector Summit 2017
Governance @ Scale: Compliance Automation in AWS | AWS Public Sector Summit 2017
 
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
GitHub Enterprise and Automation with Codedeploy - AWS Summit SG 2017
 
You Can't Protect What you Can't See. AWS Security Best Practices - Session S...
You Can't Protect What you Can't See. AWS Security Best Practices - Session S...You Can't Protect What you Can't See. AWS Security Best Practices - Session S...
You Can't Protect What you Can't See. AWS Security Best Practices - Session S...
 
Cloud Migration for Financial Services - Toronto - October 2016
Cloud Migration for Financial Services - Toronto - October 2016Cloud Migration for Financial Services - Toronto - October 2016
Cloud Migration for Financial Services - Toronto - October 2016
 
Security and Compliance Better on AWS_John Hildebrandt
Security and Compliance Better on AWS_John HildebrandtSecurity and Compliance Better on AWS_John Hildebrandt
Security and Compliance Better on AWS_John Hildebrandt
 
AWS Partnership Model - AWS - AWSome Day Zurich - 112016
AWS Partnership Model - AWS - AWSome Day Zurich - 112016AWS Partnership Model - AWS - AWSome Day Zurich - 112016
AWS Partnership Model - AWS - AWSome Day Zurich - 112016
 
Partner Solutions: Veritas Technologies - Unique Ways Veritas can Supercharge...
Partner Solutions: Veritas Technologies - Unique Ways Veritas can Supercharge...Partner Solutions: Veritas Technologies - Unique Ways Veritas can Supercharge...
Partner Solutions: Veritas Technologies - Unique Ways Veritas can Supercharge...
 
Digital Workloads on AWS
Digital Workloads on AWSDigital Workloads on AWS
Digital Workloads on AWS
 
AWS Partner Presentation - Digicomp - AWSome Day Zurich 112016
AWS Partner Presentation - Digicomp - AWSome Day Zurich 112016AWS Partner Presentation - Digicomp - AWSome Day Zurich 112016
AWS Partner Presentation - Digicomp - AWSome Day Zurich 112016
 
Interconnect with Ecosystems and Things- AWS Summit SG 2017
Interconnect with Ecosystems and Things- AWS Summit SG 2017Interconnect with Ecosystems and Things- AWS Summit SG 2017
Interconnect with Ecosystems and Things- AWS Summit SG 2017
 

Semelhante a Serverless solutions - AWS Summit SG 2017

Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2
Amazon Web Services
 

Semelhante a Serverless solutions - AWS Summit SG 2017 (20)

Serverless Microservices
Serverless MicroservicesServerless Microservices
Serverless Microservices
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Primeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverlessPrimeros pasos con arquitecturas serverless
Primeros pasos con arquitecturas serverless
 
2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS2016-06 - Design your api management strategy - AWS - Microservices on AWS
2016-06 - Design your api management strategy - AWS - Microservices on AWS
 
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
Getting Started with AWS Lambda and the Serverless Cloud by Jim Tran, Princip...
 
AWS re:Invent 2016: Serverless IoT Back Ends (IOT401)
AWS re:Invent 2016: Serverless IoT Back Ends (IOT401)AWS re:Invent 2016: Serverless IoT Back Ends (IOT401)
AWS re:Invent 2016: Serverless IoT Back Ends (IOT401)
 
Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2Data Design for Microservices - DevDay Austin 2017 Day 2
Data Design for Microservices - DevDay Austin 2017 Day 2
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T... Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
Getting Started with AWS Lambda and the Serverless Cloud - AWS Summit Cape T...
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless CloudSRV203 Getting Started with AWS Lambda and the Serverless Cloud
SRV203 Getting Started with AWS Lambda and the Serverless Cloud
 
SMC301 The State of Serverless Computing
SMC301 The State of Serverless ComputingSMC301 The State of Serverless Computing
SMC301 The State of Serverless Computing
 
Serverless applications
Serverless applicationsServerless applications
Serverless applications
 
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
AWS re:Invent 2016: Building Complex Serverless Applications (GPST404)
 
Getting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless CloudGetting Started with AWS Lambda and the Serverless Cloud
Getting Started with AWS Lambda and the Serverless Cloud
 
Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018
 
Getting Started with Serverless Architectures
Getting Started with Serverless ArchitecturesGetting Started with Serverless Architectures
Getting Started with Serverless Architectures
 

Mais de Amazon Web Services

Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
Amazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
Amazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
Amazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
Amazon Web Services
 

Mais de Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Último

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Último (20)

Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​Elevate Developer Efficiency & build GenAI Application with Amazon Q​
Elevate Developer Efficiency & build GenAI Application with Amazon Q​
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 

Serverless solutions - AWS Summit SG 2017

  • 1. © 2015, Amazon Web Services, Inc. or its Affiliates. All rights reserved. Olivier Klein 奧樂凱 Emerging Technologies SA, Asia-Pacific 11 April 2017 Serverless Solutions Build Scalable, Fault-Tolerant and Transaction-Safe Microservices on AWS
  • 3. The Monolithic Architecture - Antipattern Difficult to scale Single point of failure Not fault-tolerant Difficult to work across teams, often slow to iterate on new functionalities
  • 5. Microservices advocate creating a system from a collection of small, isolated services, each of which owns their data, scalable and resilient to failure
  • 7. No server is easier to manage…
  • 8. …than no server. No server is easier to manage…
  • 9. AWS Lambda No server is easier to manage… …than no server.
  • 10. AWS Lambda Run your code without thinking about servers. Pay only for compute time you consume. Triggered through API calls or state changes in your AWS environment Scales automatically to match the incoming event rate Charged per 100ms execution time AWS Lambda
  • 13. Architect to be Serverless Fully Managed • No provisioning • Zero Administration • High-Availability Developer Productivity • Focus on the code • Innovate rapidly • Reduce time to market Scalability • Automatically • Scale up and down
  • 14. Many Serverless Options on AWS Storage DatabaseNetwork Compute Content DeliveryMessaging and QueuesSecurity Gateways User Management Monitoring & Logging Internet of Things Machine Learning Streaming Analytics
  • 15. How to build application backends? Back-end logic DatabaseMobile
  • 16. How to build serverless microservices? AWS Lambda Amazon API Gateway Amazon DynamoDB Microservice
  • 17. Webhooks – Integrate with other platforms Facebook Page AWS Lambda Slack Channel Amazon API Gateway Amazon DynamoDB Incoming Webhook Oli just posted on your page! Oli | 2016-10- 01 | Hello
  • 18. How to get the web app to the browser? ?
  • 19. Storage and Delivery of the App Amazon S3 Amazon CloudFront Amazon S3 • Highly available object storage • Designed for 99.999999999% durability • Offers HTTP / HTTPS endpoint to objects Amazon CloudFront • Content Delivery Network with 73 edge locations across the world • Caches content on edge locations for low latency
  • 21. Serverless Game Demo AWS Lambda Amazon API Gateway Amazon S3Amazon CloudFront Browser Amazon DynamoDB
  • 24. Serverless Microservices AWS Lambda Amazon API Gateway Highly available Scalable Fault tolerant Cost effective Secure BUT: Stateless! Microservice ?
  • 25. Challenge: Centralized Database user-svc account-svccart-svc DB Applications often have a monolithic data store • Difficult to make schema changes • Technology lock-in • Vertical scaling • Single point of failure
  • 26. Centralized Database – Anti-pattern Applications often have a monolithic data store • Difficult to make schema changes • Technology lock-in • Vertical scaling • Single point of failure user-svc account-svccart-svc DB
  • 27. Decentralized Data Stores account-svccart-svc DynamoDB RDS user-svc ElastiCache RDS Polyglot Persistence Each service chooses its data store technology Low impact schema changes Independent scalability Data is gated through the service API
  • 28. CAP Theorem It is impossible for a distributed computer system to simultaneously provide all 3 of the following guarantees: Consistency Availability Partition Tolerance à In the presence of network partition we need to choose between consistency and availability
  • 29. Challenge: Transactional Integrity Polyglot persistence generally translates into eventual consistency Asynchronous calls allow non- blocking, but returns need to be handled properly How about transactional integrity? • Event-sourcing – Capture changes as sequence of events • Staged commit ERROR STATE? ROLLBACK?
  • 30. Best Practice: Use Correlation IDs 09-02-2015 15:03:24 ui-svc INFO [uuid-123] …… 09-02-2015 15:03:25 catalog-svc INFO [uuid-123] …… 09-02-2015 15:03:26 checkout-svc ERROR [uuid-123] …… 09-02-2015 15:03:27 payment-svc INFO [uuid-123] …… 09-02-2015 15:03:27 shipping-svc INFO [uuid-123] …… ui-svc catalog- svc checkout- svc shipping- svc payment- svc request correlation id: “uuid-123” correlation id: “uuid-123”
  • 31. Best Practice: Microservice owns Rollback Every microservice should expose it’s own “rollback” method This method could just rollback changes, or trigger subsequent actions (e.g. send notification) If you implement staged commit, also expose a commit function Microservice Function 1 Rollback Commit (optional)
  • 32. Event-Driven: DynamoDB Streams If async, consider event-driven approach with DynamoDB Streams Don’t need to manage function execution failure, DDB Streams automatically retries until successful “Attach” yourself to the data of interest Kinesis, SQS, SNS also possible Microservice
  • 33. Challenge: Report Errors / Rollback What if functions fail? (business logic failure, not code failure) Create a “Transaction Manager” microservice that notifies all relevant microservices to rollback or take action DynamoDB is the trigger for the clean-up function (could be SQS, Kinesis etc.) Use Correlation ID to identify relations mm-svc Transaction Manager Function DDB Streams API Call Error Table
  • 34. Challenge: Report Errors / Rollback ERROR DynamoDB Error Table Transaction Manager Function Kinesis Error Stream SQS Error Queue Rollback (correlation-id) Rollback (correlation-id) Rollback (correlation-id) Rollback (correlation-id)
  • 35. Challenge: Code Error Lambda Execution Error because of faulty / erroneous code Leverage Cloudwatch Logs to process error message and call Transaction Manager Set Cloudwatch Logs Metric Filter to look for Error/Exception and call Lambda Handler upon Alarm state ui-svc Cloudwatch Logs Cloudwatch Alarm Transaction Manager Function
  • 36. Beware: Stream Model with AWS Lambda DynamoDB Streams and Kinesis streams directly work with AWS Lambda, however AWS Lambda needs to acknowledge processing the message correctly If Lambda fails to process the message, the stream horizon will not be moved forward, creating a “jam” Solution: Monitor AWS Lambda Error Cloudwatch Metric and react when error rate of same “Correlation ID” keeps increasing
  • 37. MDM – Keep Data Consistent Databases AWS Lambda “Cleanup” Function Cloudwatch Scheduled Event Perform Master Data Management (MDM) to keep data consistent Create AWS Lambda function to check consistencies across microservices and “cleanup” Create Cloudwatch Event to schedule the function (e.g. hourly basis)
  • 38. Final Thoughts Use Amazon API Gateway to build a front-door to all your microservices (AWS Lambda, Docker, EC2 etc.) Use microservices with polyglot persistence to avoid bottlenecks, schema issues, quick iterations and allow independent scalability (and caching) Create many version and stages – no additional charges for APIs, allows for backwards compatibility Use serverless interfaces when possible – HTML5 and JS frameworks like React or Angular are useful
  • 39. Thank you! Olivier Klein 奧樂凱 Emerging Technologies SA, Asia-Pacific