SlideShare a Scribd company logo
1 of 52
Download to read offline
Serverless cloud architecture
patterns
JIMMY DAHLQVIST | 2023-11-09 | Øredev 2023
@jimmydahlqvist
Todays agenda
• Introduction
• Resiliency
• Event-Driven and Messaging
• Queues
• Summary
@jimmydahlqvist
Hello, I'm
JIMMY DAHLQVIST
Father of two girls
Serverless and event-driven fan
AWS Ambassador
AWS Community Builder
Head of AWS @ Sigma Technology Cloud
§
Introduction
@jimmydahlqvist
Producers – Consumers - Routers
@jimmydahlqvist
Orchestration vs choreography
@jimmydahlqvist
Envelope Wrapper
• Wrap original message in an envelope
• Seperation of information
• Use predefined keys
• Improved filtering and debugging
• Additional overhead
@jimmydahlqvist
Metadata - Data
{
"metadata": {
"EventId": "...",
"RetryCount": "..."
},
"data": {
"Bucket": "....",
"Key":"...."
}
}
@jimmydahlqvist
Command & Events similarities
• Messages
• Json format
@jimmydahlqvist
Command
• Proactive - Intention
• Target audience
• Asynchronous / synchronous
• CreateUser
@jimmydahlqvist
Event
• Reactive - Response
• Broadcast
• Informative
• UserCreated
Resiliency Patterns
@jimmydahlqvist
Storage First Pattern
• Data-centric design
• Durability and availability
• Scalable System Design
@jimmydahlqvist
Storage First Benefits
• Assured Data Durability
• Processing Flexibility
• Level the processing load
• High volume data ingestion
• De-duplication of data
@jimmydahlqvist
Storage First Things to consider
• Potential for increased latency
• Architectural complexity
• Need for robust storage solutions
• Maintaining data integrity
• Risk of over-optimization
@jimmydahlqvist
API gateway - SQS
@jimmydahlqvist
IoT Core - Kinesis
@jimmydahlqvist
Circuit Breaker Pattern
• Wrap protected functions in a breaker
• Prevent system overload
• Maintaining system resilience
@jimmydahlqvist
Circuit Breaker Benefits
• Avoid cascading failures
• Enhance system resilience
• Protect system resources
• Provide failover possibility
• Improve user experience
@jimmydahlqvist
Circuit Breaker Things to consider
• Need for configuration
• Risk of early circuit break
• Good observability required
• System complexity increase
• When to recover after a failure
@jimmydahlqvist
AWS StepFunctions implementation
@jimmydahlqvist
@jimmydahlqvist
AWS SQS – CloudWatch implementation
Credit: Christoph Gerkens
@jimmydahlqvist
“Everything fails all the time
Werner Vogels – CTO Amazon.com
@jimmydahlqvist
Retry with backoff
• Reduced system strain
• Optimized user experience
• Cost savings
@jimmydahlqvist
Retry with backoff
@jimmydahlqvist
Retry with backoff and jitter
• Avoid synced retries
• Distribute system load
• Increased success rates
• Adaptive
@jimmydahlqvist
Retry with backoff and jitter
@jimmydahlqvist
Retry envelope
{
”retry-metadata": {
”Count":”1”,
”Timestamp":”1234566777”,
},
”payload": {. . .}
}
@jimmydahlqvist
Implementation with StepFunctions
@jimmydahlqvist
Implementation with StepFunctions
@jimmydahlqvist
Implementation with Lambda function
Credit: Luc van Donkersgoed
Event-Driven and Messaging
Patterns
@jimmydahlqvist
Saga orchestration pattern
• Strategy to manage long-running transactions
• Both orchestration and choreography
• Each transaction publishes domain events
@jimmydahlqvist
Saga pattern benefits (Event-Driven)
• Loose coupling
• Fault isolation
• Scalable and flexible
@jimmydahlqvist
Saga pattern considerations (Event-Driven)
• Complexity
• Eventual consistency
• Event tracking
• Testing
@jimmydahlqvist
AWS implementation
@jimmydahlqvist
Data enricher pattern
• Enhancing raw data
• Easily integrate multiple data sources
• Adaptive to changing needs
• Use a message envelope
@jimmydahlqvist
Data enricher considerations
• Data integrity & security
• Data source reliability
• Latency concerns
@jimmydahlqvist
Data enricher in AWS
@jimmydahlqvist
Connected BBQ
Queue Patterns
@jimmydahlqvist
Priority Queue pattern
• High value messages processed first
• Efficient resource allocation
• Improved responsiveness
@jimmydahlqvist
Priority Queue considerations
• Defining priority
• Increased complexity
• Queue starvation
@jimmydahlqvist
AWS implementation
@jimmydahlqvist
AWS implementation
@jimmydahlqvist
Queue based load leveling
• System stability
• Handle unexpected spikes
• Protect downstream resources
@jimmydahlqvist
Queue based load leveling considerations
• Latency
• Data integrity
• Handle backpreassure
@jimmydahlqvist
AWS implementation load leveling
@jimmydahlqvist
Summary
• Looked at
• Base pattern for event-driven and messaging
• Resiliency patterns – Storage First, Circuit Breaker
• Event-driven patterns – Saga
• Queue patterns – Priority queue
• Saw examples and ways to implement in AWS
@jimmydahlqvist
@jimmydahlqvist
https://www.linkedin.com/in/dahlqvistjimmy/
https://jimmydqv.com | https://dev.to/jimmydqv
THANK YOU

More Related Content

Similar to Serverless cloud architecture patterns

A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016
A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016
A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016Shannon Lietz
 
CCCNA17 Introduction
CCCNA17 IntroductionCCCNA17 Introduction
CCCNA17 IntroductionShapeBlue
 
From AWS to Series A in 5 Easy Pieces
From AWS to Series A in 5 Easy PiecesFrom AWS to Series A in 5 Easy Pieces
From AWS to Series A in 5 Easy PiecesAmazon Web Services
 
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehouseReal-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehousePrecisely
 
cloud computing
 cloud computing cloud computing
cloud computingsripriya78
 
Cloud Computing Fundamental
Cloud Computing FundamentalCloud Computing Fundamental
Cloud Computing FundamentalDony Riyanto
 
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...Continuent
 
CloudSigma at Zadara Summit 2014
CloudSigma at Zadara Summit 2014CloudSigma at Zadara Summit 2014
CloudSigma at Zadara Summit 2014CloudSigma
 
Decentralized cloud firewall framework with resources provisioning cost optim...
Decentralized cloud firewall framework with resources provisioning cost optim...Decentralized cloud firewall framework with resources provisioning cost optim...
Decentralized cloud firewall framework with resources provisioning cost optim...aish006
 
Intellias CQRS Framework
Intellias CQRS FrameworkIntellias CQRS Framework
Intellias CQRS FrameworkSergey Seletsky
 
Event Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreEvent Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreSean Feldman
 
Google Cloud Platform
Google Cloud PlatformGoogle Cloud Platform
Google Cloud PlatformGeneXus
 
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...VMworld
 
Unlocked Nov 2013: Cloud principles track
Unlocked Nov 2013: Cloud principles trackUnlocked Nov 2013: Cloud principles track
Unlocked Nov 2013: Cloud principles trackRackspace Academy
 
Estimating the Total Costs of Your Cloud Analytics Platform 
Estimating the Total Costs of Your Cloud Analytics Platform Estimating the Total Costs of Your Cloud Analytics Platform 
Estimating the Total Costs of Your Cloud Analytics Platform DATAVERSITY
 
How to Build Multi-disciplinary Analytics Applications on a Shared Data Platform
How to Build Multi-disciplinary Analytics Applications on a Shared Data PlatformHow to Build Multi-disciplinary Analytics Applications on a Shared Data Platform
How to Build Multi-disciplinary Analytics Applications on a Shared Data PlatformCloudera, Inc.
 
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...RightScale
 
Google Cloud Fundamentals by CloudZone
Google Cloud Fundamentals by CloudZoneGoogle Cloud Fundamentals by CloudZone
Google Cloud Fundamentals by CloudZoneIdan Tohami
 
8 Elements of Multi-Cloud Security
8 Elements of Multi-Cloud Security8 Elements of Multi-Cloud Security
8 Elements of Multi-Cloud SecurityRightScale
 
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...Cloudera, Inc.
 

Similar to Serverless cloud architecture patterns (20)

A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016
A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016
A Throwaway Deck for Cloud Security Essentials 2.0 delivered at RSA 2016
 
CCCNA17 Introduction
CCCNA17 IntroductionCCCNA17 Introduction
CCCNA17 Introduction
 
From AWS to Series A in 5 Easy Pieces
From AWS to Series A in 5 Easy PiecesFrom AWS to Series A in 5 Easy Pieces
From AWS to Series A in 5 Easy Pieces
 
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data WarehouseReal-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
Real-Time Streaming: Move IMS Data to Your Cloud Data Warehouse
 
cloud computing
 cloud computing cloud computing
cloud computing
 
Cloud Computing Fundamental
Cloud Computing FundamentalCloud Computing Fundamental
Cloud Computing Fundamental
 
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...
Webinar Slides: MySQL Data Protection: Medical SaaS Manages Sensitive HIPAA C...
 
CloudSigma at Zadara Summit 2014
CloudSigma at Zadara Summit 2014CloudSigma at Zadara Summit 2014
CloudSigma at Zadara Summit 2014
 
Decentralized cloud firewall framework with resources provisioning cost optim...
Decentralized cloud firewall framework with resources provisioning cost optim...Decentralized cloud firewall framework with resources provisioning cost optim...
Decentralized cloud firewall framework with resources provisioning cost optim...
 
Intellias CQRS Framework
Intellias CQRS FrameworkIntellias CQRS Framework
Intellias CQRS Framework
 
Event Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and moreEvent Grid - quiet event to revolutionize Azure and more
Event Grid - quiet event to revolutionize Azure and more
 
Google Cloud Platform
Google Cloud PlatformGoogle Cloud Platform
Google Cloud Platform
 
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...
VMworld 2013: Symantec’s Real-World Experience with a VMware Software-Defined...
 
Unlocked Nov 2013: Cloud principles track
Unlocked Nov 2013: Cloud principles trackUnlocked Nov 2013: Cloud principles track
Unlocked Nov 2013: Cloud principles track
 
Estimating the Total Costs of Your Cloud Analytics Platform 
Estimating the Total Costs of Your Cloud Analytics Platform Estimating the Total Costs of Your Cloud Analytics Platform 
Estimating the Total Costs of Your Cloud Analytics Platform 
 
How to Build Multi-disciplinary Analytics Applications on a Shared Data Platform
How to Build Multi-disciplinary Analytics Applications on a Shared Data PlatformHow to Build Multi-disciplinary Analytics Applications on a Shared Data Platform
How to Build Multi-disciplinary Analytics Applications on a Shared Data Platform
 
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...
Transitioning to the Cloud: Implications for Reliability, Redundancy & Recove...
 
Google Cloud Fundamentals by CloudZone
Google Cloud Fundamentals by CloudZoneGoogle Cloud Fundamentals by CloudZone
Google Cloud Fundamentals by CloudZone
 
8 Elements of Multi-Cloud Security
8 Elements of Multi-Cloud Security8 Elements of Multi-Cloud Security
8 Elements of Multi-Cloud Security
 
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...
Multidisziplinäre Analyseanwendungen auf einer gemeinsamen Datenplattform ers...
 

More from Jimmy Dahlqvist

Building a serverless AI powered translation service
Building a serverless AI powered translation serviceBuilding a serverless AI powered translation service
Building a serverless AI powered translation serviceJimmy Dahlqvist
 
AI Powered event-driven translation bot
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation botJimmy Dahlqvist
 
IoT Enabled Smoker for Great BBQ
IoT Enabled Smoker for Great BBQIoT Enabled Smoker for Great BBQ
IoT Enabled Smoker for Great BBQJimmy Dahlqvist
 
Building a serverless event driven Slack Bot
Building a serverless event driven Slack BotBuilding a serverless event driven Slack Bot
Building a serverless event driven Slack BotJimmy Dahlqvist
 
IoT enable smoker for great BBQ
IoT enable smoker  for great BBQIoT enable smoker  for great BBQ
IoT enable smoker for great BBQJimmy Dahlqvist
 
Autoscaled Github Runners using StepFunctions
Autoscaled Github Runners using StepFunctionsAutoscaled Github Runners using StepFunctions
Autoscaled Github Runners using StepFunctionsJimmy Dahlqvist
 
EventBridge Patterns and real world use case
EventBridge Patterns and real world use caseEventBridge Patterns and real world use case
EventBridge Patterns and real world use caseJimmy Dahlqvist
 
re:Invent Recap Breakfast
re:Invent Recap Breakfastre:Invent Recap Breakfast
re:Invent Recap BreakfastJimmy Dahlqvist
 
CI/CD As first and last line of defence
CI/CD As first and last line of defenceCI/CD As first and last line of defence
CI/CD As first and last line of defenceJimmy Dahlqvist
 
CHAOS ENGINEERING – OR LET'S SHAKE THE TREE
CHAOS ENGINEERING – OR LET'S SHAKE THE TREECHAOS ENGINEERING – OR LET'S SHAKE THE TREE
CHAOS ENGINEERING – OR LET'S SHAKE THE TREEJimmy Dahlqvist
 
Road to an asynchronous device registration API
Road to an asynchronous device registration APIRoad to an asynchronous device registration API
Road to an asynchronous device registration APIJimmy Dahlqvist
 
GitOps in action, powered by Alexa.
GitOps in action, powered by Alexa.GitOps in action, powered by Alexa.
GitOps in action, powered by Alexa.Jimmy Dahlqvist
 

More from Jimmy Dahlqvist (12)

Building a serverless AI powered translation service
Building a serverless AI powered translation serviceBuilding a serverless AI powered translation service
Building a serverless AI powered translation service
 
AI Powered event-driven translation bot
AI Powered event-driven translation botAI Powered event-driven translation bot
AI Powered event-driven translation bot
 
IoT Enabled Smoker for Great BBQ
IoT Enabled Smoker for Great BBQIoT Enabled Smoker for Great BBQ
IoT Enabled Smoker for Great BBQ
 
Building a serverless event driven Slack Bot
Building a serverless event driven Slack BotBuilding a serverless event driven Slack Bot
Building a serverless event driven Slack Bot
 
IoT enable smoker for great BBQ
IoT enable smoker  for great BBQIoT enable smoker  for great BBQ
IoT enable smoker for great BBQ
 
Autoscaled Github Runners using StepFunctions
Autoscaled Github Runners using StepFunctionsAutoscaled Github Runners using StepFunctions
Autoscaled Github Runners using StepFunctions
 
EventBridge Patterns and real world use case
EventBridge Patterns and real world use caseEventBridge Patterns and real world use case
EventBridge Patterns and real world use case
 
re:Invent Recap Breakfast
re:Invent Recap Breakfastre:Invent Recap Breakfast
re:Invent Recap Breakfast
 
CI/CD As first and last line of defence
CI/CD As first and last line of defenceCI/CD As first and last line of defence
CI/CD As first and last line of defence
 
CHAOS ENGINEERING – OR LET'S SHAKE THE TREE
CHAOS ENGINEERING – OR LET'S SHAKE THE TREECHAOS ENGINEERING – OR LET'S SHAKE THE TREE
CHAOS ENGINEERING – OR LET'S SHAKE THE TREE
 
Road to an asynchronous device registration API
Road to an asynchronous device registration APIRoad to an asynchronous device registration API
Road to an asynchronous device registration API
 
GitOps in action, powered by Alexa.
GitOps in action, powered by Alexa.GitOps in action, powered by Alexa.
GitOps in action, powered by Alexa.
 

Recently uploaded

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts servicesonalikaur4
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作ys8omjxb
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewingbigorange77
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)Christopher H Felton
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts servicevipmodelshub1
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Dana Luther
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Paul Calvano
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一z xss
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一Fs
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一Fs
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一Fs
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkataanamikaraghav4
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Personfurqan222004
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Roomdivyansh0kumar0
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsThierry TROUIN ☁
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012rehmti665
 
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdf
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdfThe Intriguing World of CDR Analysis by Police: What You Need to Know.pdf
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdfMilind Agarwal
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Lucknow
 

Recently uploaded (20)

Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Porur Phone 🍆 8250192130 👅 celebrity escorts service
 
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
Potsdam FH学位证,波茨坦应用技术大学毕业证书1:1制作
 
Denver Web Design brochure for public viewing
Denver Web Design brochure for public viewingDenver Web Design brochure for public viewing
Denver Web Design brochure for public viewing
 
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
A Good Girl's Guide to Murder (A Good Girl's Guide to Murder, #1)
 
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts serviceChennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
Chennai Call Girls Alwarpet Phone 🍆 8250192130 👅 celebrity escorts service
 
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
Packaging the Monolith - PHP Tek 2024 (Breaking it down one bite at a time)
 
Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24Font Performance - NYC WebPerf Meetup April '24
Font Performance - NYC WebPerf Meetup April '24
 
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
办理(UofR毕业证书)罗切斯特大学毕业证成绩单原版一比一
 
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
定制(UAL学位证)英国伦敦艺术大学毕业证成绩单原版一比一
 
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
定制(Management毕业证书)新加坡管理大学毕业证成绩单原版一比一
 
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
定制(AUT毕业证书)新西兰奥克兰理工大学毕业证成绩单原版一比一
 
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls in Uttam Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls KolkataRussian Call Girls in Kolkata Samaira 🤌  8250192130 🚀 Vip Call Girls Kolkata
Russian Call Girls in Kolkata Samaira 🤌 8250192130 🚀 Vip Call Girls Kolkata
 
Complet Documnetation for Smart Assistant Application for Disabled Person
Complet Documnetation   for Smart Assistant Application for Disabled PersonComplet Documnetation   for Smart Assistant Application for Disabled Person
Complet Documnetation for Smart Assistant Application for Disabled Person
 
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130  Available With RoomVIP Kolkata Call Girl Kestopur 👉 8250192130  Available With Room
VIP Kolkata Call Girl Kestopur 👉 8250192130 Available With Room
 
AlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with FlowsAlbaniaDreamin24 - How to easily use an API with Flows
AlbaniaDreamin24 - How to easily use an API with Flows
 
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
Call Girls South Delhi Delhi reach out to us at ☎ 9711199012
 
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Serviceyoung call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
young call girls in Uttam Nagar🔝 9953056974 🔝 Delhi escort Service
 
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdf
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdfThe Intriguing World of CDR Analysis by Police: What You Need to Know.pdf
The Intriguing World of CDR Analysis by Police: What You Need to Know.pdf
 
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja VipCall Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
Call Girls Service Adil Nagar 7001305949 Need escorts Service Pooja Vip
 

Serverless cloud architecture patterns

Editor's Notes

  1. Kortade ner titel jämför med cloud….
  2. I started working with cloud several years ago, I was part of a team that built a new system that was going to handle information coming from end users. What was very important in this solution was that no messages coming from the end users could be lost, we needed to ensure we processed them all. We decided to go for a serverless solution and used AWS ApiGateway together with an SQS queue, and then processed the messages in an async way. At that time I didn’t realize that this pattern actually had a name….. This is what we are going to talk about here today, we will look at some of the patterns I use the most and that I think is the most essential. It’s clearly a oppinionated talk from that perspective, but in the end we should have put some names to them. PIZZA EXAMPLES!
  3. Before we start and deep dive into different patterns, we should establish some common ground. And define some patterns, definitions and concepts that I will return to in several of the patterns
  4. Event Producers are a system or a service that create and publish events and commands. AWS services, clients, Saas applications and more can be a producer. Event Router this is a service or system that routes events and commands to consumers. This can be queues, event brokers, etc. There are several AWS services that can act as message router, such as SQS, SNS, IoT Core, and EventBridge. Event Consumer are the system or service that react on, consume, specific events or commands and carry out work accordingly. Our consumers can be services implemented with AWS services, it can be other SaaS services, API Endpoints, and other.
  5. Orchestration A centralized control pattern where a single orchestrator (often a service or function) dictates the control flow, making decisions about which functions should be executed, in which order, and managing data flow between them. AWS StepFunctions! Choreography: A decentralized control pattern where each service or function knows what to do when an event occurs. There's no central authority directing traffic; rather, services interact in a loosely coupled manner based on events. AWS Event Bridge
  6. Key Points: Central Control: One service/function dictates the flow. Predictable Flow: Control flow is predefined and can be visualized easily. Tight Coupling: The orchestrator is often tightly coupled with services, knowing about their interfaces and data.
  7. Decentralized Control: No single point dictates the flow; services/functions react to events. Loose Coupling: Services are decoupled, only knowing about the events they produce or consume. Scalable & Flexible: Easy to add or modify services without changing the entire system. Self-Managed: Services handle their own failures and compensating actions based on events.
  8. By using the we wrap the original message in an envelope, that way we can…. We need to use prdefined keys, as this gives both the producer and consumer….
  9. Metadata – data pattern….. Very popular Invented back in 2020 by Sheen Brials at Lego Group…. The data key is the original message, the payload. The metadata key gives us the possibility to add additional information ABOUT the message.
  10. The similarities Use JSON for all messages, this is an opinionated design, but it’s a good pratcice for a well designed message system. So don’t use txt, xml, yaml, protobuf
  11. Now let’s move into the relalm of Resiliency and some patterns that can help us.
  12. Definition: The "Storage First" architecture pattern emphasizes putting persistent storage at the forefront of system design, ensuring data durability and availability before considering other components. Key Principle: Designing systems around the notion that data storage is the central pillar, optimizing for data retention, retrieval, and resilience. When to Use: High data ingestion systems where data loss is critical. Systems requiring consistent backup and failover capabilities. Applications where real-time processing is secondary to data capture.
  13. Data Durability: Ensuring data is stored safely reduces risks related to data loss. Flexibility: Once data is stored, it can be processed, transformed, or analyzed in various ways without worrying about initial capture. Scalability Level the processing load: By prioritizing storage, systems can efficiently handle large volumes of data without immediate processing. In a high volume event-driven system, slow consumers can slow down the producers if the consumer process the event synchronously. Instead, by storing the event immediately, reporting success, and then process on their own time, the producers will not be slowed down. By storing the data before processing, the consumers can also implement an efficient message de-duplication for data that has been sent twice. In most event-driven architectures data will be delivered with a “At-least-once” approach. Cost-Efficient: Optimizing for storage can lead to reduced costs in data retrieval and processing.
  14. Latency: Prioritizing storage might increase the time it takes to process or access the data in real-time scenarios. Complexity: Designing with storage in mind may lead to intricate architectures, especially when integrating with diverse processing systems. Prerequisites: Requires robust and often expensive storage solutions to ensure data durability and high availability. Data Integrity: Ensuring data stored is accurate and consistent can pose challenges, especially in high ingestion systems. Potential for Over-Optimization: There's a risk of over-investing in storage without considering the balance of other architectural needs.
  15. PIZZA ORDER!!
  16. Definition: A design pattern used in software development to improve system stability and prevent cascading failures by detecting faults and halting system operations, much like an electrical circuit breaker. Key Principle: The circuit breaker monitors requests to a service and "trips" (or opens) to stop sending requests to a failing service, giving it time to recover. When to Use: Microservices architectures where failures in one service might cascade to others. Systems that rely on external services or APIs that might be unreliable. Applications where preserving system functionality during partial failures is crucial.
  17. System Stability: Reduces the risk of system-wide outages due to a single point of failure. Resource Protection: Prevents resource exhaustion by halting requests to a failing component. Enhanced User Experience: By avoiding system hang or timeouts, users receive quicker feedback even during failures. Facilitates System Recovery: Provides failing components an opportunity to recover without being inundated with requests. Predictable Failures: System components fail in a predictable manner, allowing for easier troubleshooting and maintenance.
  18. Configuration Overhead: Proper thresholds and timeouts need to be set, which might require fine-tuning. Risk of False Positives: Might trip during transient failures, causing unnecessary disruption. Complexity: Introduces additional logic and monitoring into the system. Dependency on Monitoring: Requires robust monitoring and alerting to function effectively. Recovery Strategy: Deciding when and how to close (or reset) the circuit breaker can be challenging.
  19. Get circuit status from DynamoDB If Closed carry out work and update status If open – Check if sufficient time has passed for a retry If so Carry out work and update status if NO no retry
  20. Now let’s look at a combination with Storage First where we like to process messages in a Queue using a Lambda Function. I need to give credit to Cristoph Gerkens that created the first variant that I later modified. In this: Lambda send logs and metrics to CloudWatch -> in case of failures this trigger an alarm that invokes a Lambda function, that disabled the Lambda integration on the queue. When the Alarm goes back to OK this will invoke a stepfunction, that polls a messages from the queue and makes an test invoke with that message to the lambda function doing the work, if this is an success the integration is enabled. EventBridge on a schedule invokes the stepfunction that check if the integration is enabled, if not it does an test invoke.
  21. This is a very famous quote…. And it’s very true, everything fails all the time and we need to be able to handle failures and retry. PIZZA schedule delivery….
  22. Our application need to handle failures and retry the operations. And we should not just retry….. We need to retry with an exponential backoff. Meaning that we first retry after 1s then 2s, 4s, 8s and so on….. This will: Reduce System load and strain and let’t the failing component breathe….. It creates a better user experience We can save cost by not burning CPU cycles
  23. There is an very interesting study done by AWS on this topic, that show how retries cluster in a large distrubited system.
  24. So we should not just do retry with backoff, we should also add jitter to this. Meaning that we add a random sleep to each backoff operation. This will then avoid synced synced retries…. It will distribute the load on the failing component more even, because after healing in case of a synced retry from many clients this can cause another failure and outage. It will increase the success rate since we distrubite the retries. And it’s a very adaptive way of handling retry
  25. Now the same study with jitter added, we can see that the clustering is less frequent.
  26. So ho can we now implement retries in a smart way in serverless AWS? First, let’s introduce a retry envelope, based on the envelope wrapper pattern. Here we add metadata about retries so we can keep track of attempts, when it was last run etc.
  27. So how could a implementation in StepFunctions then look like? We can utlize the StepFunctions built in ability to catch errors. When Lambda fail e use the retry metadata to calculate a wait time based on that. We then can then wait thet amount of time and try again. If we reach our upper limit of number of retrties we add the message to a DLQ for manual processing.
  28. So if we look at an StepFunctions visualization
  29. Here is a setup where Lambda get invoked asynch by something. Credit given to Luc…. That first wrote about this setup. Lambda Fails -> onFailure destination to SQS. SQS polled by Lambda event source. Retry manager checks the ”Retry Metadata” puts back to queue and set the visibility timeout. Next time message is returned, the Manager invokes the “Work Lambda” and the loop continue….
  30. That was a few resiellncy patterns… Now let us move over and look at some event-driven and messagsing patterns….
  31. A pattern I use very often is the Saga Pattern. Which is a way to manage long running transactions. It’s possible to use both in an orchestration and choreography scenario, but we will focus on choreography. In this pattern, each completed transaction will publish a domain event to inform on what just happened sp the next part in the saga can pick up.
  32. With the Saga pattern, even if we're not using traditional ACID transactions, we can still ensure data is consistent across services. As each service in the pattern is loosely coupled, we gain the flexibility to develop, deploy, and scale services independently. If one transaction fails, the entire system doesn’t crash. Instead, compensating actions are triggered to rectify the inconsistency.
  33. There might be additional complexity in the system, so it might be hard to track the transactions and where in the chain it is. The system will be Eventual consistency, since a transaction can be in the middle of everything. We must make sure we use the envelope wrapper so we can add eventid to it so we can track the saga. Testinh might be hard, since it might require us to run the full saga for every test
  34. So by using eventbridge each service can publish events that other services can track… So in this example it all start with a Pizza Order being created…..
  35. The Data Enricher Pattern is about enhancing the value of data by combining it with other relevant data sources. At its core, the Data Enricher Pattern aims to elevate the inherent value of raw data by integrating it with additional context. This enhancement transforms simple data into information, making it more actionable. This richer dataset is a boon for decision-makers, offering a more comprehensive view of the situation. One of the pattern's strengths is its automation, streamlining data processes and reducing manual errors. Furthermore, it's a versatile pattern. Whether you're integrating data from APIs, databases, or other systems, the pattern facilitates this combination, offering a more holistic dataset. Importantly, as your business grows and evolves, so can your data enrichment sources, ensuring your data remains relevant and valuable.
  36. One of the top considerations when adopting the Data Enricher Pattern is maintaining the data's integrity and quality. The enrichment should add value, not distort or degrade the original data. Reliability is another concern. If you're depending on third-party data sources, their availability and trustworthiness become crucial. As you integrate diverse data sources, be prepared to handle complex integration scenarios, ensuring smooth data flow. Also, while the pattern aims to provide enriched data, it's important to be aware of potential latency, especially if real-time data processing is essential. Lastly, and perhaps most importantly, when dealing with sensitive or third-party data, uphold the highest standards of data privacy and security.
  37. PIZZA membership…. Discounts…
  38. Messages are processed based on their priority rather than their arrival order High value messages processed first
  39. We can use computer resources efficient We can improve the system responisvness for high priority customers. We can see it as customers with high member status get processed first.
  40. This we need to consider in this pattern is how do we: Define priority -> Must be clear There is an increased complexity with more queues Queue starvation can happen…. Low prio never get processed.
  41. In this case we can’t guarntee the order and Normal prio and high prio will be intermixed.
  42. Instead we would need to do something like this….. Where we check the prio of the message and if there are high prio messages in queue or not.
  43. Next queue pattern that we need to talk about is queue based load leveling….. This is when we use a queue in between a high volume producer and a slow consumer, where the producer have high spikes. That way we can level the load on the consumer and ensure it doesn’t get over whelmed in the spikes. Increased system stability Handle spikes Protect downstream services
  44. What we need to consider when implementing this, is that it will come with increased latency -> Since messages during a spike will be in the queue longer. The data integrity we need to consider that – the system will be eventually consistence And backperassure? How do we handle the case when the queue keep growing and the consumer can’t keep up? There are two ways to handle it. Eirher we add more consumers or we set TTL on the messages and send old messages to a DLQ or discard them.
  45. If you remember the very first story I told…. We actually used load leveling with storage first. This scenario was from Sony and we processed messages from mobile phones. Every time a phone started up it sent us a message. So when there was a new sw for the phone, we got huge spikes, since most pople actually update their phones at the same time…..