SlideShare a Scribd company logo
@berndruecker
Lost in transaction?
Strategies to manage consistency
in serverless architectures
An example for today – the classical one
λ
Book Car
λ
Book
Hotel
λ
Book
Flight
Function collaboration
λ
Book Car
λ
Book
Hotel
λ
Book
Flight
Book a
trip?
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
A
C
I
D
Atomicity
Consistency
Isolation
Durability
@berndruecker
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
There is two-phase commit (XA)!!
TX
Coordinator
Resource
Managers
Prepare
Phase
Commit
Phase
@berndruecker
Pat Helland
“
Distributed Systems Guru
Worked at Amazon,
Microsoft & Salesforce
@berndruecker
Pat Helland
Grown-Ups Don’t Use
Distributed Transactions
“
Distributed Systems Guru
Worked at Amazon,
Microsoft & Salesforce
@berndruecker
Eric Brewer
Atomicity
Consistency
Isolation
Durability
http://pld.cs.luc.edu/courses/353/spr11/notes/brewer_keynote.pdf @berndruecker
That means
Temporarily
inconsistent
Eventually
consistent
againt
Consistent
Local
ACID
Local
ACID
Violates „I“
of ACID
@berndruecker
λ
Book Car
λ
Book Hotel
„Building on Quicksand“ Paper
A
C
I
D
2.0Pat Helland
@berndruecker
Associative
Commutative
Idempotent
Distributed
2.0
(a + b) + c = a + (b + c)
a + b = b + a
f(x) = f( f(x) )
„Building on Quicksand“ Paper
Pat Helland
@berndruecker
Distributed
@berndruecker
Distributed systems
@berndruecker
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
Not idempotent
Idempotent
bookHotel(hotel, duration)
bookHotel(tripId,
hotel, duration)
Photo by pixabay, available under Creative Commons CC0 1.0 license.
@berndruecker
Requirement: Idempotency of services!
Photo by pixabay, available under Creative Commons CC0 1.0 license.
@berndruecker
Requirement: Idempotency of services!
Photo by Chr.Späth, available under Public Domain.
@berndruecker
Distributed systems
@berndruecker
It is impossible to
differentiate certain
failure scenarios:
Independant of
communication style!
@berndruecker
Orchestration / coordinator function
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
// book har
invokeCar()
// book hotel
invokeHotel()
// book hotel
try {
bookHotel()
} catch (err) {
cancelHotel()
}
Cleanup!
λ
(Trip)
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
PUT&
DELETE
// book har
invokeCar()
Orchestration with workflow
λ
(Trip)
// book har
startTripWorkflow()
λ
(Car)
$.post(carHireUrl,
...
λ
(Hotel)
$.post(carHireUrl,
...
Workflow Engine
Car -> Hotel ->
...
Warning:
Contains Opinion
Berlin, Germany
bernd.ruecker@camunda.com
@berndruecker
Bernd Ruecker
Co-founder and
Chief Technologist of
Camunda
Example
λ
(Car)
λ
(Hotel)
Workflow Engine
λ
(Flight)λ
(Trip)
Leverage retrying
λ
(Car)
λ
(Hotel)
Workflow Engine
λ
(Flight)λ
(Trip)
Leverage stateful retrying
λ
(Car)
λ
(Hotel)
Workflow Engine
λ
(Flight)λ
(Trip)
But how to solve ACID?
@berndruecker
@berndruecker
Compensation – the classical example
Saga
book
hotel
book
car
book
flight
cancel
hotel
cancel
car
1. 2. 3.
5.6.
In case of failure
trigger compensations
book
trip
2 alterntive approaches: choreography & orchestration
@berndruecker
Event-driven choreography
Hotel
Flight
Car
Trip
Trip
booked
Flight
booked
Trip
requested
Hotel
booked
Car
booked
Request
trip
@berndruecker
Event-driven choreography
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
Perform undo
(cancel car booking)
Perform undo
(cancel hotel)
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
The danger is that it's very easy to make
nicely decoupled systems with event
notification, without realizing that you're
losing sight of that larger-scale flow, and
thus set yourself up for trouble in future
years.
https://martinfowler.com/articles/201701-event-driven.html
@berndruecker
Implementing changes in the process
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
@berndruecker
Implementing changes in the process
Hotel
Flight
Car
Trip
Trip
failed
Trip
requested
Hotel
booked
Car
booked
Request
trip
Flight
failed
Car
canceled
Hotel
canceled
You have to adjust all services and redeploy at the same time!
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
@berndruecker
What we wanted
Photo by Lijian Zhang, available under Creative Commons SA 2.0 License and CC BY-SA 4.0
@berndruecker
Orchestration
Hotel
Flight
Car
Trip
Trip
booked
Request
trip
Book
hotel
Hotel
booked
Car
booked
Flight
booked
Book
car
Book
flight
@berndruecker
Orchestration
Hotel
Flight
Car
Trip
Trip
booked
Request
trip
Book
hotel
Hotel
booked
Car
booked
Flight
booked
Book
car
Book
flight
We have a new basic agreement
with the car rental agency and
can cancel for free within 1 hour
– do that first!
You have to adjust one service and redeploy only this one!
@berndruecker
Compensation
with workflow
Workflow Engine
λ
(Trip)
Saga Pattern
(implemented by BPMN
compensation)
Live hacking
https://github.com/berndruecker/trip-booking-saga-serverless
Workflow engine based on BPMN
Cloud-native
Source-available
Available as managed service
Demo architecture with Zeebe & Camunda Cloud
Camunda Cloud
Your AWS account
Zeebe Client
BPMN Workflow Definition
Trip Booking Function
Hotel Booking Function
…
Zeebe
API
Gateway
start
Invoke function
via HTTP
Deployed
onto Zeebe
Graphical models?
@berndruecker
Clemens Vasters
Architect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
Clemens Vasters
Architect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
Clemens Vasters
Architect at Microsoft
http://vasters.com/archive/Sagas.html
@berndruecker
Living documentation for long-running behaviour
@berndruecker
BizDevOps
@berndruecker
Step Functions
https://read.acloud.guru/how-the-saga-pattern-manages-failures-with-aws-lambda-and-
step-functions-bc8f7129f900
Think of more complicated scenarios…
Recap
• Function coordination might include orchestration and
workflow
• Carefully decide about choreography vs. orchestration
• Grown ups don‘t use distributed transactions
but eventual consistency
• Idempotency is super important!
• Know Saga / Compensation as strategy
Thank you!
@berndruecker
mail@berndruecker.io
@berndruecker
https://berndruecker.io
https://medium.com/berndruecker
https://github.com/berndruecker
https://www.infoq.com/articles/events-
workflow-automation
Contact:
Slides:
Blog:
Code:
https://www.infoworld.com/article/3254777/
application-development/
3-common-pitfalls-of-microservices-
integrationand-how-to-avoid-them.html
https://thenewstack.io/5-workflow-automation-
use-cases-you-might-not-have-considered/

More Related Content

PDF
Serverless London 2019 - Coordination of Serverless Functions
PDF
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
PDF
Serverless Days 2019 - Lost in transaction
PDF
DDD Europe 2019: Lost in transaction
PDF
Reactive Summit 2020 - How state helps you to stay reactive
PDF
2019 - Lost in transaction
PDF
Destination Automation: Automating Processes in Modern Hipster Architectures
PDF
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration
Serverless London 2019 - Coordination of Serverless Functions
Lost in transaction - Strategies to deal with (in)consistency in distributed ...
Serverless Days 2019 - Lost in transaction
DDD Europe 2019: Lost in transaction
Reactive Summit 2020 - How state helps you to stay reactive
2019 - Lost in transaction
Destination Automation: Automating Processes in Modern Hipster Architectures
Camunda Con Live 2020 Keynote - Microservice Orchestration and Integration

Similar to Bernd Rücker - Lost in transaction? Strategies to manage consistency in serverless architectures (20)

PDF
OOP 2021 - Leverage the full potential of your hipster architecture
PDF
Orchestrating Touchpoints - From Business to Buttons 2014
PDF
Chris Risdon - Orchestrating Touchpoints (From Business to Buttons 2014)
PDF
User Stories: Across the Seven Product Dimensions
PDF
Automating Processes in Modern Architectures
PDF
20140704 Fast and Furious Customer Journey Mapping Oracle Banks
PDF
2020 06-03 cukenfest-bdd-and-sl_os
PDF
BASTA! Orchestration of microservices
PDF
Kafka Summit 2021 - Apache Kafka meets workflow engines
PDF
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
DOCX
chetan_ahire_resume
PPT
e-DMC: The web-based planning solution
PDF
Rameshkumar-E.compressed
PPTX
Build_generative_AI_applications_with_Amazon_Bedrock_and_open_source_framewor...
PDF
Bon Voyage Whitepaper_210w x 297h mm_Ref
PPTX
P I Infosoft Introduction And Travel Products
PDF
Distributed sagas a protocol for coordinating microservices
PDF
Decision Making in Product Design
DOCX
Pawan_Kumar_111
PDF
sharfaheeknew
OOP 2021 - Leverage the full potential of your hipster architecture
Orchestrating Touchpoints - From Business to Buttons 2014
Chris Risdon - Orchestrating Touchpoints (From Business to Buttons 2014)
User Stories: Across the Seven Product Dimensions
Automating Processes in Modern Architectures
20140704 Fast and Furious Customer Journey Mapping Oracle Banks
2020 06-03 cukenfest-bdd-and-sl_os
BASTA! Orchestration of microservices
Kafka Summit 2021 - Apache Kafka meets workflow engines
Apache Kafka Meets Workflow Engines | Bernd Ruecker, Camunda
chetan_ahire_resume
e-DMC: The web-based planning solution
Rameshkumar-E.compressed
Build_generative_AI_applications_with_Amazon_Bedrock_and_open_source_framewor...
Bon Voyage Whitepaper_210w x 297h mm_Ref
P I Infosoft Introduction And Travel Products
Distributed sagas a protocol for coordinating microservices
Decision Making in Product Design
Pawan_Kumar_111
sharfaheeknew
Ad

More from AWSCOMSUM (20)

PDF
Introducing AWS DeepRacer: David Smith
PDF
Beyond serverless.pptx
PPTX
Will hall - Accelerating Infrastructure as Code and Configuration Management ...
PDF
Onur Salk & Onur Gurdamar - Everything as Code: Creating an application stack...
PDF
Nils Mohr & Jake Pearce - 100 years of flight data at British Airways. Past, ...
PDF
Phil Basford - machine learning at scale with aws sage maker
PDF
Dan pudwell - AWS community summit-oct-2019
PDF
Mike fowler - Getting started with machine learning (london 2019)
PPTX
Efi Merdler Kravitz - 7 things you should know before going serverless
PDF
Michelle Chismon - Anything is possible!* Learning with AWS DeepLens *But not...
PDF
Ben Bridts - $ aws help
PDF
Richard pablo - IoT Provisioning Solving the nightmare
PDF
Matt Houghton - AWS Comsum - October 2019
PDF
Bruno Amaro Almeida - What can aws tell us about fake and credible news medi...
PDF
Serhat Can- 4 keytakeaways from running serverless on production for 4 years
PDF
Stuart jones - Deconstructing the monolith. Migrating complex systems simply ...
PPTX
Dwp achieving cloud adoption at enterprise scale | Diptesh Patel
PDF
RUNNING AWS LOCALLY
PDF
Multi accountstrategy | david lewthwaite
PDF
Serverless for Visual Journalism at the BBC | Doug Winter
Introducing AWS DeepRacer: David Smith
Beyond serverless.pptx
Will hall - Accelerating Infrastructure as Code and Configuration Management ...
Onur Salk & Onur Gurdamar - Everything as Code: Creating an application stack...
Nils Mohr & Jake Pearce - 100 years of flight data at British Airways. Past, ...
Phil Basford - machine learning at scale with aws sage maker
Dan pudwell - AWS community summit-oct-2019
Mike fowler - Getting started with machine learning (london 2019)
Efi Merdler Kravitz - 7 things you should know before going serverless
Michelle Chismon - Anything is possible!* Learning with AWS DeepLens *But not...
Ben Bridts - $ aws help
Richard pablo - IoT Provisioning Solving the nightmare
Matt Houghton - AWS Comsum - October 2019
Bruno Amaro Almeida - What can aws tell us about fake and credible news medi...
Serhat Can- 4 keytakeaways from running serverless on production for 4 years
Stuart jones - Deconstructing the monolith. Migrating complex systems simply ...
Dwp achieving cloud adoption at enterprise scale | Diptesh Patel
RUNNING AWS LOCALLY
Multi accountstrategy | david lewthwaite
Serverless for Visual Journalism at the BBC | Doug Winter
Ad

Recently uploaded (20)

PPTX
1. Introduction to Computer Programming.pptx
PDF
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
PDF
WOOl fibre morphology and structure.pdf for textiles
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
Web App vs Mobile App What Should You Build First.pdf
PDF
Accuracy of neural networks in brain wave diagnosis of schizophrenia
PDF
Hybrid model detection and classification of lung cancer
PPTX
TLE Review Electricity (Electricity).pptx
PDF
Hindi spoken digit analysis for native and non-native speakers
PDF
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
PDF
Assigned Numbers - 2025 - Bluetooth® Document
PPTX
Tartificialntelligence_presentation.pptx
PPTX
Chapter 5: Probability Theory and Statistics
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PDF
Encapsulation theory and applications.pdf
PDF
Getting Started with Data Integration: FME Form 101
PDF
DP Operators-handbook-extract for the Mautical Institute
PDF
Heart disease approach using modified random forest and particle swarm optimi...
PDF
A novel scalable deep ensemble learning framework for big data classification...
PDF
NewMind AI Weekly Chronicles - August'25-Week II
1. Introduction to Computer Programming.pptx
From MVP to Full-Scale Product A Startup’s Software Journey.pdf
WOOl fibre morphology and structure.pdf for textiles
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Web App vs Mobile App What Should You Build First.pdf
Accuracy of neural networks in brain wave diagnosis of schizophrenia
Hybrid model detection and classification of lung cancer
TLE Review Electricity (Electricity).pptx
Hindi spoken digit analysis for native and non-native speakers
Microsoft Solutions Partner Drive Digital Transformation with D365.pdf
Assigned Numbers - 2025 - Bluetooth® Document
Tartificialntelligence_presentation.pptx
Chapter 5: Probability Theory and Statistics
Building Integrated photovoltaic BIPV_UPV.pdf
Encapsulation theory and applications.pdf
Getting Started with Data Integration: FME Form 101
DP Operators-handbook-extract for the Mautical Institute
Heart disease approach using modified random forest and particle swarm optimi...
A novel scalable deep ensemble learning framework for big data classification...
NewMind AI Weekly Chronicles - August'25-Week II

Bernd Rücker - Lost in transaction? Strategies to manage consistency in serverless architectures