SlideShare a Scribd company logo
@crichardson
Dark energy, dark matter and
microservice architecture
collaboration patterns
Chris Richardson


Microservice architecture consultant and trainer


Founder of the original CloudFoundry.com


Author of POJOs in Action and Microservices Patterns


Founder of Eventuate.io


@crichardson


chris@chrisrichardson.net


http://adopt.microservices.io
Copyright © 2022. Chris Richardson Consulting, Inc. All rights reserved
@crichardson
Presentation goal
How to design system
operations that span multiple
services
@crichardson
About Chris
http://adopt.microservices.io
@crichardson
Discounts
35% discount


au35ric


$100 discount coupon


GBXCCPJD until July 11th
http://adopt.microservices.io
@crichardson
Agenda
Dark energy, dark matter and de
fi
ning a microservice
architecture


Overview of service collaboration patterns


Designing system commands


Designing system queries
@crichardson
How to de
fi
ne an
Architecture…
Application
≪subdomain≫


Customer
management
≪aggregate≫


Customer
≪subdomain≫


Order
management
≪aggregate≫


Order
createCustomer()
createOrder()
fi
ndOrder()
fi
ndOrderHistory()
System operations
Distill
Requirements
Event storming
Functional requirements
As a consumer
I want to place an Order
So that I can ….
As a Restaurant
I want to accept an Order
So that I can ….
User stories
• SLA: Reliability/Latency


• Scalability


• …
System quality attributes
The “requests” that the
application implements
Customer Team
Order Team
About Subdomains
• Business capability/function/etc


• Logical view: packages and classes


• Team-sized


• Loosely coupled (Conways law)
1
2
@crichardson
Application
… how to de
fi
ne an
Architecture…
Application
≪subdomain≫


Customer
≪aggregate≫


Customer
≪subdomain≫


Order
≪aggregate≫


Order
createCustomer()
createOrder()
fi
ndOrder()
fi
ndOrderHistory()
System operations
Component
≪subdomain≫
≪subdomain≫
≪subdomain≫
≪subdomain≫
How to group
subdomains
into
components*?
Component Component
* Component = deployable, executable, e.g. WAR
fi
le, executable JAR, …
3
Deployable, Executable,


e.g. WAR
fi
le, executable
JAR, …
@crichardson
Application
… how to de
fi
ne an
Architecture
createCustomer()
createOrder()
fi
ndOrder()
fi
ndOrderHistory()
System operations
Component
≪subdomain≫
≪subdomain≫
Component
≪subdomain≫
≪subdomain≫
Component
Design
collaborations*
Distributed
4
*Collaboration =
interactions via REST,
messages etc.
@crichardson
Grouping subdomains into
components: together or separate?
≪subdomain≫


Customer
≪aggregate≫


Customer
≪subdomain≫


Order
≪aggregate≫


Order
Attraction
Repulsion
Generated by
system operations
Simple components


Team-sized services


Fast deployment pipeline


…
Dark energy: an anti-
gravity that’s accelerating
the expansion of the
universe
Dark matter: an invisible
matter that has a
gravitational effect on stars
and galaxies.
https://www.nasa.gov/feature/goddard/2020/new-hubble-data-explains-missing-dark-matter
Simple interactions


Prefer ACID or BASE


Minimize runtime coupling


…
https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html
@crichardson
Dark energy: repulsive forces
subdomains in different services
https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html
Service
Service
«Subdomain» A
«Aggregate»
X
«Subdomain» B
«Aggregate»
Y
Simple components
Team autonomy
Fast deployment pipeline
Support multiple technology stacks
Cost effective scaling
Segregate regulated software
Segregate highly available components
@crichardson
Dark matter: attractive forces
subdomains in same service
https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html
Subdomain A
«Aggregate»
X
Subdomain B
«Aggregate»
Y
Service A Service B
Simple interactions
Prefer ACID over BASE
Minimize runtime coupling
Efficient communication
Minimize design time coupling
SystemOperation()
Generates
@crichardson
The role of the architect is to
balance con
fl
icting forces
Minimize attraction
Service
Subdomain
Subdomain
Minimize


repulsion
Service
Subdomain
Subdomain
Minimize


repulsion
Con
fl
icting goals
@crichardson
Balancing forces is an iterative process
Partition subdomains to
de
fi
ne services to resolve
dark energy forces
Design system operations


(service collaborations) to
resolve dark matter forces
Adjust service de
fi
nitions to enable
resolution of dark matter forces
@crichardson
Agenda
Dark energy, dark matter and de
fi
ning a microservice
architecture


Overview of service collaboration patterns


Designing system commands


Designing system queries
@crichardson
After partitioning subdomains into services:
• Simple interactions


• Prefer ACID over BASE


• Minimize runtime coupling


• Ef
fi
cient inter-service communication


• Minimize design time coupling
createCustomer()
Customer
Service
createOrder()
Order
Service
Restaurant
Service
Customer
Service
Collaboration
✅ ?
Local operation Distributed operation
≪entity≫


Restaurant
≪entity≫


Customer
≪entity≫


Order
≪entity≫


Customer
ACID transaction ??? transaction
Owned by
service
@crichardson
Distributed system operation =


ACID transaction
Customer
Service
Restaurant
Service
createOrder()
Order Service
Distributed ACID transaction
BEGIN transaction


…


COMMIT transaction
@crichardson
Pattern: Shared database schema
Order Service
Customer
Service
Order
table
Customer
table
createOrder()
ACID


Transaction


(Maybe 2PC)
https://microservices.io/patterns/data/shared-database.html
reserveCredit()
creditOrder()
… Service
… table
BEGIN transaction


…


COMMIT transaction
@crichardson
Bene
fi
ts and drawbacks: shared schema
Dark energy repulsive forces
Support multiple technology stacks ❌ DBs be able to participate in same transaction
Dark matter attractive forces
Simple interactions ✅ No service-service interaction!?
Prefer ACID over BASE ✅ ACID transaction
Minimize runtime coupling ❌ DB-level coupling/interference
Ef
fi
cient inter-service communication ✅ No service-service interaction!?
Minimize design time coupling
❌ Schema changes must be coordinated


❌ Duplicated business logic
@crichardson
Pattern: Private database schema
Order Service
Customer
Service
Order


table
Customer
table
API
createOrder()
2PC


Transaction
https://microservices.io/patterns/data/database-per-service.html
reserveCredit()
BEGIN transaction


…


COMMIT transaction
@crichardson
Private database + 2PC: Bene
fi
ts and drawbacks
Dark energy repulsive forces
Support multiple technology stacks


❌ Participants must use 2PC-
compatible technology
Dark matter attractive forces
Simple interactions ? Depends on operation
Prefer ACID over BASE


✅
Minimize runtime coupling ❌ all participants must be available
Ef
fi
cient inter-service communication ? Depends on operation
Minimize design time coupling ? Depends on operation
@crichardson
Distributed system operation =


Basically Available, Soft state, Eventually
consistent transaction
Service A
Transaction scope


=


service
distributedOperation()
BEGIN transaction


…


COMMIT transaction
Service B
BEGIN transaction


…


COMMIT transaction
Service C
BEGIN transaction


…


COMMIT transaction
@crichardson
ACID vs. BASE
2PC BASE
Dark energy repulsive forces
Support multiple technology stacks ❌ ✅
Dark matter attractive forces
Prefer ACID over BASE ✅ ❌
Minimize runtime coupling ❌ ✅ (Mostly)
@crichardson
Eventually consistent service
collaboration patterns
API Composition
Provider
Service
Service
query()
Composer
Provider
Service
Provider
Service
CQRS
Provider
Service
Service
query()
View
Provider
Service
Provider
Service
Event
Event
Event
Service
Service Service
Transaction
Compensating
transaction
Transaction
Compensating
transaction
Transaction
Compensating
transaction
command()
Saga
Service
Service
command()
Replica Source
Event
Command-side replica
Commands
Queries
@crichardson
Agenda
Dark energy, dark matter and de
fi
ning a microservice
architecture


Overview of service collaboration patterns


Designing system commands


Designing system queries
@crichardson
Let’s imagine that you are implementing
the createOrder() command…
Service Operation Potential failure
Order Service Create Order Invalid quantities
Restaurant Service
Validate and price menu
items (Order subtotal)
Invalid menu items
Customer Service Reserve credit Insuf
fi
cient credit
Kitchen Service Create Ticket Out of stock ingredient
@crichardson
Command patterns
Service
Service Service
Transaction
Compensating
transaction
Transaction
Compensating
transaction
Transaction
Compensating
transaction
command()
Saga
Service
Service
command()
Replica Source
Event
Command-side replica
@crichardson
From a 1987 paper Service
Service Service
Transaction
Compensating
transaction
Transaction
Compensating
transaction
Transaction
Compensating
transaction
command()
Saga
@crichardson
Saga = sequence of local transactions
Service A
Local ACID


transaction
Service B
Local ACID


transaction
Service C
Local ACID


transaction
https://microservices.io/patterns/data/saga.html
@crichardson
The CreateOrderSaga
Step Participant Transaction
Compensating
transaction
1 Order Service createOrder() rejectOrder()
2 Restaurant Service validateAndPrice() -
3 Order Service updateSubtotal() -
4 Customer Service reserveCredit() releaseCredit()
5 Kitchen Service createTicket()
6 Order Service approveOrder() Can fail!
Undo
Lock
Unlock
Unlock
Semantic lock countermeasure = Semantic ACID
Can fail!
Need to rollback
@crichardson
Saga coordination =
sequencing of steps
Choreography: distributed decision making


vs.


Orchestration: centralized decision making
@crichardson
Choreography-based Create Order
Saga
Order Created
Credit Reserved
Create Order
Order


state


total


…
create()
…
Order events channel
Customer events channel
Order


Service
Customer


Service
Restaurant


Service
Restaurants events channel
Order total calculated
MenuItems Priced
Ticket Created
Kitchen


Service
Kitchen events channel
Order credit reserved
approve()
@crichardson
Order Service
CreateOrderSaga orchestrator
Restaurant
Service
Order


state


total…
reserveCredit()
CreateOrder


Saga
OrderService
create()
create()
…
Items Priced
Restaurant command channel
Saga reply channel
Create Order Order ID
Customer Service
Customer command channel
validateAndPrice()
Credit Reserved
updateSubtotal()
Kitchen Service
Kitchen command channel
approve()
@crichardson
Bene
fi
ts and drawbacks of Sagas
Dark energy repulsive forces
Support multiple technology stacks


✅
Dark matter attractive forces
Simple interactions ? Depends on command
Prefer ACID over BASE ❌
Minimize runtime coupling ? Depends on command
Ef
fi
cient inter-service communication ? Depends on command
Minimize design time coupling ? Depends on command
Force: Prefer ACID over BASE ❌
No automatic undo =>
extra work to implement
compensating
transactions


Potential complexity of
undoing changes to data
that was changed by
another transaction
Create Order Saga Create Order Saga
Order Service:


createOrder()
Customer Service:


reserveCredit()
Order Service:


createOrder()
Customer Service:


reserveCredit()
Kitchen Service:


createTicket()
Customer Service:


releaseCredit()
FAILS!
Compensating transaction:


• Undoes change to available credit


• Fortunately: add/subtract commute
Updates


available credit
Force: Prefer ACID over BASE ❌
Sagas are ACD - lack I =
isolation => concurrent
execution => potential data
anomalies:


Dirty reads


Lost updates


Fuzzy reads


Must implement
countermeasures = application-
level ACID, e.g. Semantic lock
Cancel Order Saga Create Order Saga
Order Service:


cancelOrder()
Customer Service:


releaseCredit()
Order Service:


createOrder()
Customer Service:


reserveCredit()
Kitchen Service:


createTicket()
Customer Service:


reserveCredit()
Dirty read:
Exceeds customer
credit limit
FAILS!
Compensating transaction
@crichardson
Force: Minimize runtime coupling -
depends on when response is sent
Order
Service
createOrder()
Order Created
1
Response
2
3
✅
Order
Service
createOrder()
Ticket Created
1
Response
7
8
Self-Contained
Restaurant
Service
Customer
Service
Kitchen Service
Tightly coupled ❌
@crichardson
Force: minimize design-time
coupling
Order
Service
Restaurant
Service
Customer
Service
Order
Service
Restaurant
Service
Customer
Service
Choreography Orchestration
Participants depend on each other Orchestrator depends on participants
Inappropriate
knowledge of
Orders? Simple API
@crichardson
Sagas are potentially complex


BUT
They can be simple


It depends
Order Service
createOrder()
Ful
fi
llment Service
Order Created
@crichardson
Service
Service
command()
Replica Source
Event
Command-side replica
@crichardson
Using a command-side replica
Order Service
createOrder()
Restaurant
Service
Orders
Restaurants
Restaurant events
Replica
Validate and price line
items without invoking
Restaurant Service
Restaurant
MenuItem
MenuItem
createRestaurant()
@crichardson
Bene
fi
ts and drawbacks of Command-side replica
Dark energy repulsive forces
Support multiple technology stacks ✅ e.g. even different DBs
Dark matter attractive forces
Simple interactions
✅ Eliminates interaction with participant


❌ Other cmds must publish events
Prefer ACID over BASE ❌ Risk of stale/inconsistent data
Minimize runtime coupling
✅ Command does not interact with
participant
Ef
fi
cient inter-service communication
✅ Command is less distributed


❌ Cost of replication - storage + events
Minimize design time coupling
? Risk of tightly coupling view to
providers
@crichardson
Force: Minimize runtime coupling -
non-local but self-contained operation
Order Service
createOrder()
Orders
Restaurants
Response
Outcome of
validating and
pricing line
items
https://microservices.io/patterns/decomposition/self-contained-service.html
@crichardson
Agenda
Dark energy, dark matter and de
fi
ning a microservice
architecture


Overview of service collaboration patterns


Designing system commands


Designing system queries
@crichardson
Let’s imagine that you are
implementing the
fi
ndOrder() query
Service Operation
Order Service Status of order: line items
Kitchen Service Status of ticket: ready for pickup
Delivery Service Status of delivery: ETA
Accounting Service Status of payment: total including tax
@crichardson
Query patterns
API Composition
Provider
Service
Service
query()
Composer
Provider
Service
Provider
Service
CQRS
Provider
Service
Service
query()
View
Provider
Service
Provider
Service
Event
Event
Event
@crichardson
API Composition pattern
Order Service
Order
status
Delivery
Service
Delivery
Accounting
Service
Order
status
API Gateway
GET /orders/id
GET /orders?orderId=id
GET /orders/id
GET /deliveries?orderId=id
status


eta
Kitchen
Service
Ticket
status


prepareBy
GET /tickets?orderId=id
{… response …}
API
Composer
Providers
Composer
@crichardson
Bene
fi
ts and drawbacks of API Composition
Dark energy repulsive forces
Support multiple technology stacks


✅
Dark matter attractive forces
Simple interactions ? Possibility of many roundtrips
Prefer ACID over BASE
❌ Multiple queries - potential for inconsistencies


Minimize runtime coupling
❌ Use resiliency patterns (eg. Circuit breaker) to
reduce impact
Ef
fi
cient inter-service communication
? Parallelization can reduce latency
Possibility of many roundtrips or large data transfers
Minimize design time coupling ❌ Composer coupled to providers
@crichardson
Inef
fi
cient API composition:
fi
ndOrderHistory()
Order Service
Order
status
Delivery Service
Delivery
Accounting Service
Order
status
API Gateway
GET /orders?


consumerId=abc&


text=noodles&offset=ABC
GET /orders?


consumerId=abc&


text=noodles&offset=ABC
GET /deliveries?


consumerId=abc&


text=noodles&offset=ABC
GET /orders?


consumerId=abc&


text=noodles&offset=ABC
X X
No line items for text search


Different sort order
status


eta
Order


Line


Item
Composer
@crichardson
CQRS
Provider
Service
Service
query()
View
Provider
Service
Provider
Service
Event
Event
Event
@crichardson
Implementing a query using CQRS
Order
Service
Delivery
Service
Order events
Delivery events
fi
ndOrderHistory()
Order events channel
Delivery events channel
Order
History


Service
Replica
View
Database
https://microservices.io/patterns/data/cqrs.html
… Service
… events channel
… events
@crichardson
Bene
fi
ts and drawbacks of CQRS
Dark matter repulsive forces
Support multiple technology stacks


✅ View DB different than Provider DBs
Dark matter attractive forces
Simple interactions
✅ Query is local


❌ Other cmds must publish events
Prefer ACID over BASE ❌ Out of order events => Inconsistencies
Minimize runtime coupling ✅
Ef
fi
cient inter-service communication
✅ Query is self-contained


❌ Cost of replication - storage + events
Minimize design time coupling
? Risk of view being tightly coupled to
providers
@crichardson
Summary: a microservice architecture
must balance con
fl
icting forces
Service
Subdomain
Subdomain
Service
Subdomain
Subdomain
Minimize dark
energy repulsive
forces
Con
fl
icting
Minimize dark matter
attractive forces
systemOperation()
Minimize dark
energy repulsive
forces
generates
@crichardson
Summary: design system operations
using the collaboration patterns
API Composition
Provider
Service
Service
query()
Composer
Provider
Service
Provider
Service
CQRS
Provider
Service
Service
query()
View
Provider
Service
Provider
Service
Event
Event
Event
Service
Service Service
Transaction
Compensating
transaction
Transaction
Compensating
transaction
Transaction
Compensating
transaction
command()
Saga
Service
Service
command()
Replica Source
Event
Command-side replica
Distributed ACID transactions
X
@crichardson
Summary:


Adjust service boundaries if dark
matter forces cannot be suf
fi
ciently
resolved
@crichardson
@crichardson chris@chrisrichardson.net
http://adopt.microservices.io
Questions?
au35ric GBXCCPJD

More Related Content

Similar to Dark energy, dark matter and microservice architecture collaboration patterns

YOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous MicroservicesYOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous Microservices
Chris Richardson
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
Chris Richardson
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Chris Richardson
 
Developing applications with a microservice architecture (SVforum, microservi...
Developing applications with a microservice architecture (SVforum, microservi...Developing applications with a microservice architecture (SVforum, microservi...
Developing applications with a microservice architecture (SVforum, microservi...
Chris Richardson
 
Solving distributed data management problems in a microservice architecture (...
Solving distributed data management problems in a microservice architecture (...Solving distributed data management problems in a microservice architecture (...
Solving distributed data management problems in a microservice architecture (...
Chris Richardson
 
Developing applications with a microservice architecture (svcc)
Developing applications with a microservice architecture (svcc)Developing applications with a microservice architecture (svcc)
Developing applications with a microservice architecture (svcc)
Chris Richardson
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...
Chris Richardson
 
A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)
Chris Richardson
 
Gluecon: Using sagas to maintain data consistency in a microservice architecture
Gluecon: Using sagas to maintain data consistency in a microservice architectureGluecon: Using sagas to maintain data consistency in a microservice architecture
Gluecon: Using sagas to maintain data consistency in a microservice architecture
Chris Richardson
 
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with SagasJavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
Chris Richardson
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled services
Chris Richardson
 
TU Delft Presentation - Cloud & Serverless
TU Delft Presentation - Cloud & ServerlessTU Delft Presentation - Cloud & Serverless
TU Delft Presentation - Cloud & Serverless
Sander Knape
 
Mucon: Not Just Events: Developing Asynchronous Microservices
Mucon: Not Just Events: Developing Asynchronous MicroservicesMucon: Not Just Events: Developing Asynchronous Microservices
Mucon: Not Just Events: Developing Asynchronous Microservices
Chris Richardson
 
Oracle Code One: Events and commands: developing asynchronous microservices
Oracle Code One: Events and commands: developing asynchronous microservicesOracle Code One: Events and commands: developing asynchronous microservices
Oracle Code One: Events and commands: developing asynchronous microservices
Chris Richardson
 
agile microservices @scaibo
agile microservices @scaiboagile microservices @scaibo
agile microservices @scaibo
Ciro Donato Caiazzo
 
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Chris Richardson
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Chris Richardson
 
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
GotoChgo 2019: Not Just Events: Developing Asynchronous MicroservicesGotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
Chris Richardson
 
microXchg: Managing data consistency in a microservice architecture using Sagas
microXchg: Managing data consistency in a microservice architecture using SagasmicroXchg: Managing data consistency in a microservice architecture using Sagas
microXchg: Managing data consistency in a microservice architecture using Sagas
Chris Richardson
 
Dev conf .in cloud native reference architecture .advance
Dev conf .in cloud native reference architecture .advanceDev conf .in cloud native reference architecture .advance
Dev conf .in cloud native reference architecture .advance
Christina Lin
 

Similar to Dark energy, dark matter and microservice architecture collaboration patterns (20)

YOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous MicroservicesYOW2018 - Events and Commands: Developing Asynchronous Microservices
YOW2018 - Events and Commands: Developing Asynchronous Microservices
 
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice ArchitectureQConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
QConPlus 2021: Minimizing Design Time Coupling in a Microservice Architecture
 
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
Mucon 2021 - Dark energy, dark matter: imperfect metaphors for designing micr...
 
Developing applications with a microservice architecture (SVforum, microservi...
Developing applications with a microservice architecture (SVforum, microservi...Developing applications with a microservice architecture (SVforum, microservi...
Developing applications with a microservice architecture (SVforum, microservi...
 
Solving distributed data management problems in a microservice architecture (...
Solving distributed data management problems in a microservice architecture (...Solving distributed data management problems in a microservice architecture (...
Solving distributed data management problems in a microservice architecture (...
 
Developing applications with a microservice architecture (svcc)
Developing applications with a microservice architecture (svcc)Developing applications with a microservice architecture (svcc)
Developing applications with a microservice architecture (svcc)
 
Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...Events to the rescue: solving distributed data problems in a microservice arc...
Events to the rescue: solving distributed data problems in a microservice arc...
 
A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)A pattern language for microservices (#gluecon #gluecon2016)
A pattern language for microservices (#gluecon #gluecon2016)
 
Gluecon: Using sagas to maintain data consistency in a microservice architecture
Gluecon: Using sagas to maintain data consistency in a microservice architectureGluecon: Using sagas to maintain data consistency in a microservice architecture
Gluecon: Using sagas to maintain data consistency in a microservice architecture
 
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with SagasJavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
JavaOne2017: ACID Is So Yesterday: Maintaining Data Consistency with Sagas
 
Designing loosely coupled services
Designing loosely coupled servicesDesigning loosely coupled services
Designing loosely coupled services
 
TU Delft Presentation - Cloud & Serverless
TU Delft Presentation - Cloud & ServerlessTU Delft Presentation - Cloud & Serverless
TU Delft Presentation - Cloud & Serverless
 
Mucon: Not Just Events: Developing Asynchronous Microservices
Mucon: Not Just Events: Developing Asynchronous MicroservicesMucon: Not Just Events: Developing Asynchronous Microservices
Mucon: Not Just Events: Developing Asynchronous Microservices
 
Oracle Code One: Events and commands: developing asynchronous microservices
Oracle Code One: Events and commands: developing asynchronous microservicesOracle Code One: Events and commands: developing asynchronous microservices
Oracle Code One: Events and commands: developing asynchronous microservices
 
agile microservices @scaibo
agile microservices @scaiboagile microservices @scaibo
agile microservices @scaibo
 
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
Oracle CodeOne 2019: Decompose Your Monolith: Strategies for Migrating to Mic...
 
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdfScenarios_and_Architecture_SkillsMatter_April_2022.pdf
Scenarios_and_Architecture_SkillsMatter_April_2022.pdf
 
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
GotoChgo 2019: Not Just Events: Developing Asynchronous MicroservicesGotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
GotoChgo 2019: Not Just Events: Developing Asynchronous Microservices
 
microXchg: Managing data consistency in a microservice architecture using Sagas
microXchg: Managing data consistency in a microservice architecture using SagasmicroXchg: Managing data consistency in a microservice architecture using Sagas
microXchg: Managing data consistency in a microservice architecture using Sagas
 
Dev conf .in cloud native reference architecture .advance
Dev conf .in cloud native reference architecture .advanceDev conf .in cloud native reference architecture .advance
Dev conf .in cloud native reference architecture .advance
 

More from Chris Richardson

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?
Chris Richardson
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
Chris Richardson
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021
Chris Richardson
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Chris Richardson
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
Chris Richardson
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...
Chris Richardson
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
Chris Richardson
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders application
Chris Richardson
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith
Chris Richardson
 
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
JFokus: Cubes, Hexagons, Triangles, and More: Understanding MicroservicesJFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
Chris Richardson
 
Decompose your monolith: strategies for migrating to microservices (Tide)
Decompose your monolith: strategies for migrating to microservices (Tide)Decompose your monolith: strategies for migrating to microservices (Tide)
Decompose your monolith: strategies for migrating to microservices (Tide)
Chris Richardson
 
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Chris Richardson
 
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
Chris Richardson
 
MicroCPH - Managing data consistency in a microservice architecture using Sagas
MicroCPH - Managing data consistency in a microservice architecture using SagasMicroCPH - Managing data consistency in a microservice architecture using Sagas
MicroCPH - Managing data consistency in a microservice architecture using Sagas
Chris Richardson
 
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Chris Richardson
 
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
Chris Richardson
 

More from Chris Richardson (16)

The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?The microservice architecture: what, why, when and how?
The microservice architecture: what, why, when and how?
 
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
YOW London - Considering Migrating a Monolith to Microservices? A Dark Energy...
 
A pattern language for microservices - June 2021
A pattern language for microservices - June 2021 A pattern language for microservices - June 2021
A pattern language for microservices - June 2021
 
Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)Microservices - an architecture that enables DevOps (T Systems DevOps day)
Microservices - an architecture that enables DevOps (T Systems DevOps day)
 
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
DDD SoCal: Decompose your monolith: Ten principles for refactoring a monolith...
 
Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...Decompose your monolith: Six principles for refactoring a monolith to microse...
Decompose your monolith: Six principles for refactoring a monolith to microse...
 
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
TDC2020 - The microservice architecture: enabling rapid, reliable, frequent a...
 
Overview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders applicationOverview of the Eventuate Tram Customers and Orders application
Overview of the Eventuate Tram Customers and Orders application
 
#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith#DevNexus202 Decompose your monolith
#DevNexus202 Decompose your monolith
 
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
JFokus: Cubes, Hexagons, Triangles, and More: Understanding MicroservicesJFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
JFokus: Cubes, Hexagons, Triangles, and More: Understanding Microservices
 
Decompose your monolith: strategies for migrating to microservices (Tide)
Decompose your monolith: strategies for migrating to microservices (Tide)Decompose your monolith: strategies for migrating to microservices (Tide)
Decompose your monolith: strategies for migrating to microservices (Tide)
 
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
Oracle CodeOne 2019: Descending the Testing Pyramid: Effective Testing Strate...
 
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
YOW! Perth: Cubes, Hexagons, Triangles, and More: Understanding the Microserv...
 
MicroCPH - Managing data consistency in a microservice architecture using Sagas
MicroCPH - Managing data consistency in a microservice architecture using SagasMicroCPH - Managing data consistency in a microservice architecture using Sagas
MicroCPH - Managing data consistency in a microservice architecture using Sagas
 
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
Melbourne Jan 2019 - Microservices adoption anti-patterns: Obstacles to decom...
 
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
OReilly SACON London: Potholes in the road from monolithic hell: Microservice...
 

Recently uploaded

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
Green Software Development
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
sjcobrien
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
Alina Yurenko
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
Bert Jan Schrijver
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
safelyiotech
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
rodomar2
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
ICS
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
Rakesh Kumar R
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
Grant Fritchey
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
brainerhub1
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
Patrick Weigel
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
Peter Muessig
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
Quickdice ERP
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
ToXSL Technologies
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
Massimo Artizzu
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
kalichargn70th171
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
mz5nrf0n
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
Octavian Nadolu
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
Drona Infotech
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
NishanthaBulumulla1
 

Recently uploaded (20)

Energy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina JonuziEnergy consumption of Database Management - Florina Jonuzi
Energy consumption of Database Management - Florina Jonuzi
 
Malibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed RoundMalibou Pitch Deck For Its €3M Seed Round
Malibou Pitch Deck For Its €3M Seed Round
 
All you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVMAll you need to know about Spring Boot and GraalVM
All you need to know about Spring Boot and GraalVM
 
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
J-Spring 2024 - Going serverless with Quarkus, GraalVM native images and AWS ...
 
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
Safelyio Toolbox Talk Softwate & App (How To Digitize Safety Meetings)
 
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CDKuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
KuberTENes Birthday Bash Guadalajara - Introducción a Argo CD
 
Webinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for EmbeddedWebinar On-Demand: Using Flutter for Embedded
Webinar On-Demand: Using Flutter for Embedded
 
How to write a program in any programming language
How to write a program in any programming languageHow to write a program in any programming language
How to write a program in any programming language
 
Using Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query PerformanceUsing Query Store in Azure PostgreSQL to Understand Query Performance
Using Query Store in Azure PostgreSQL to Understand Query Performance
 
Unveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdfUnveiling the Advantages of Agile Software Development.pdf
Unveiling the Advantages of Agile Software Development.pdf
 
WWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders AustinWWDC 2024 Keynote Review: For CocoaCoders Austin
WWDC 2024 Keynote Review: For CocoaCoders Austin
 
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsUI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
UI5con 2024 - Boost Your Development Experience with UI5 Tooling Extensions
 
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesE-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian Companies
 
How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?How Can Hiring A Mobile App Development Company Help Your Business Grow?
How Can Hiring A Mobile App Development Company Help Your Business Grow?
 
Liberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptxLiberarsi dai framework con i Web Component.pptx
Liberarsi dai framework con i Web Component.pptx
 
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf8 Best Automated Android App Testing Tool and Framework in 2024.pdf
8 Best Automated Android App Testing Tool and Framework in 2024.pdf
 
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
原版定制美国纽约州立大学奥尔巴尼分校毕业证学位证书原版一模一样
 
Artificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension FunctionsArtificia Intellicence and XPath Extension Functions
Artificia Intellicence and XPath Extension Functions
 
Mobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona InfotechMobile App Development Company In Noida | Drona Infotech
Mobile App Development Company In Noida | Drona Infotech
 
YAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring detailsYAML crash COURSE how to write yaml file for adding configuring details
YAML crash COURSE how to write yaml file for adding configuring details
 

Dark energy, dark matter and microservice architecture collaboration patterns

  • 1. @crichardson Dark energy, dark matter and microservice architecture collaboration patterns Chris Richardson Microservice architecture consultant and trainer Founder of the original CloudFoundry.com Author of POJOs in Action and Microservices Patterns Founder of Eventuate.io @crichardson chris@chrisrichardson.net http://adopt.microservices.io Copyright © 2022. Chris Richardson Consulting, Inc. All rights reserved
  • 2. @crichardson Presentation goal How to design system operations that span multiple services
  • 4. @crichardson Discounts 35% discount au35ric $100 discount coupon GBXCCPJD until July 11th http://adopt.microservices.io
  • 5. @crichardson Agenda Dark energy, dark matter and de fi ning a microservice architecture Overview of service collaboration patterns Designing system commands Designing system queries
  • 6. @crichardson How to de fi ne an Architecture… Application ≪subdomain≫ Customer management ≪aggregate≫ Customer ≪subdomain≫ Order management ≪aggregate≫ Order createCustomer() createOrder() fi ndOrder() fi ndOrderHistory() System operations Distill Requirements Event storming Functional requirements As a consumer I want to place an Order So that I can …. As a Restaurant I want to accept an Order So that I can …. User stories • SLA: Reliability/Latency • Scalability • … System quality attributes The “requests” that the application implements Customer Team Order Team About Subdomains • Business capability/function/etc • Logical view: packages and classes • Team-sized • Loosely coupled (Conways law) 1 2
  • 7. @crichardson Application … how to de fi ne an Architecture… Application ≪subdomain≫ Customer ≪aggregate≫ Customer ≪subdomain≫ Order ≪aggregate≫ Order createCustomer() createOrder() fi ndOrder() fi ndOrderHistory() System operations Component ≪subdomain≫ ≪subdomain≫ ≪subdomain≫ ≪subdomain≫ How to group subdomains into components*? Component Component * Component = deployable, executable, e.g. WAR fi le, executable JAR, … 3 Deployable, Executable, e.g. WAR fi le, executable JAR, …
  • 8. @crichardson Application … how to de fi ne an Architecture createCustomer() createOrder() fi ndOrder() fi ndOrderHistory() System operations Component ≪subdomain≫ ≪subdomain≫ Component ≪subdomain≫ ≪subdomain≫ Component Design collaborations* Distributed 4 *Collaboration = interactions via REST, messages etc.
  • 9. @crichardson Grouping subdomains into components: together or separate? ≪subdomain≫ Customer ≪aggregate≫ Customer ≪subdomain≫ Order ≪aggregate≫ Order Attraction Repulsion Generated by system operations Simple components Team-sized services Fast deployment pipeline … Dark energy: an anti- gravity that’s accelerating the expansion of the universe Dark matter: an invisible matter that has a gravitational effect on stars and galaxies. https://www.nasa.gov/feature/goddard/2020/new-hubble-data-explains-missing-dark-matter Simple interactions Prefer ACID or BASE Minimize runtime coupling … https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html
  • 10. @crichardson Dark energy: repulsive forces subdomains in different services https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html Service Service «Subdomain» A «Aggregate» X «Subdomain» B «Aggregate» Y Simple components Team autonomy Fast deployment pipeline Support multiple technology stacks Cost effective scaling Segregate regulated software Segregate highly available components
  • 11. @crichardson Dark matter: attractive forces subdomains in same service https://chrisrichardson.net/post/microservices/2021/11/30/dark-matter-dark-energy.html Subdomain A «Aggregate» X Subdomain B «Aggregate» Y Service A Service B Simple interactions Prefer ACID over BASE Minimize runtime coupling Efficient communication Minimize design time coupling SystemOperation() Generates
  • 12. @crichardson The role of the architect is to balance con fl icting forces Minimize attraction Service Subdomain Subdomain Minimize repulsion Service Subdomain Subdomain Minimize repulsion Con fl icting goals
  • 13. @crichardson Balancing forces is an iterative process Partition subdomains to de fi ne services to resolve dark energy forces Design system operations (service collaborations) to resolve dark matter forces Adjust service de fi nitions to enable resolution of dark matter forces
  • 14. @crichardson Agenda Dark energy, dark matter and de fi ning a microservice architecture Overview of service collaboration patterns Designing system commands Designing system queries
  • 15. @crichardson After partitioning subdomains into services: • Simple interactions • Prefer ACID over BASE • Minimize runtime coupling • Ef fi cient inter-service communication • Minimize design time coupling createCustomer() Customer Service createOrder() Order Service Restaurant Service Customer Service Collaboration ✅ ? Local operation Distributed operation ≪entity≫ Restaurant ≪entity≫ Customer ≪entity≫ Order ≪entity≫ Customer ACID transaction ??? transaction Owned by service
  • 16. @crichardson Distributed system operation = ACID transaction Customer Service Restaurant Service createOrder() Order Service Distributed ACID transaction BEGIN transaction … COMMIT transaction
  • 17. @crichardson Pattern: Shared database schema Order Service Customer Service Order table Customer table createOrder() ACID Transaction (Maybe 2PC) https://microservices.io/patterns/data/shared-database.html reserveCredit() creditOrder() … Service … table BEGIN transaction … COMMIT transaction
  • 18. @crichardson Bene fi ts and drawbacks: shared schema Dark energy repulsive forces Support multiple technology stacks ❌ DBs be able to participate in same transaction Dark matter attractive forces Simple interactions ✅ No service-service interaction!? Prefer ACID over BASE ✅ ACID transaction Minimize runtime coupling ❌ DB-level coupling/interference Ef fi cient inter-service communication ✅ No service-service interaction!? Minimize design time coupling ❌ Schema changes must be coordinated ❌ Duplicated business logic
  • 19. @crichardson Pattern: Private database schema Order Service Customer Service Order table Customer table API createOrder() 2PC Transaction https://microservices.io/patterns/data/database-per-service.html reserveCredit() BEGIN transaction … COMMIT transaction
  • 20. @crichardson Private database + 2PC: Bene fi ts and drawbacks Dark energy repulsive forces Support multiple technology stacks ❌ Participants must use 2PC- compatible technology Dark matter attractive forces Simple interactions ? Depends on operation Prefer ACID over BASE ✅ Minimize runtime coupling ❌ all participants must be available Ef fi cient inter-service communication ? Depends on operation Minimize design time coupling ? Depends on operation
  • 21. @crichardson Distributed system operation = Basically Available, Soft state, Eventually consistent transaction Service A Transaction scope = service distributedOperation() BEGIN transaction … COMMIT transaction Service B BEGIN transaction … COMMIT transaction Service C BEGIN transaction … COMMIT transaction
  • 22. @crichardson ACID vs. BASE 2PC BASE Dark energy repulsive forces Support multiple technology stacks ❌ ✅ Dark matter attractive forces Prefer ACID over BASE ✅ ❌ Minimize runtime coupling ❌ ✅ (Mostly)
  • 23. @crichardson Eventually consistent service collaboration patterns API Composition Provider Service Service query() Composer Provider Service Provider Service CQRS Provider Service Service query() View Provider Service Provider Service Event Event Event Service Service Service Transaction Compensating transaction Transaction Compensating transaction Transaction Compensating transaction command() Saga Service Service command() Replica Source Event Command-side replica Commands Queries
  • 24. @crichardson Agenda Dark energy, dark matter and de fi ning a microservice architecture Overview of service collaboration patterns Designing system commands Designing system queries
  • 25. @crichardson Let’s imagine that you are implementing the createOrder() command… Service Operation Potential failure Order Service Create Order Invalid quantities Restaurant Service Validate and price menu items (Order subtotal) Invalid menu items Customer Service Reserve credit Insuf fi cient credit Kitchen Service Create Ticket Out of stock ingredient
  • 27. @crichardson From a 1987 paper Service Service Service Transaction Compensating transaction Transaction Compensating transaction Transaction Compensating transaction command() Saga
  • 28. @crichardson Saga = sequence of local transactions Service A Local ACID transaction Service B Local ACID transaction Service C Local ACID transaction https://microservices.io/patterns/data/saga.html
  • 29. @crichardson The CreateOrderSaga Step Participant Transaction Compensating transaction 1 Order Service createOrder() rejectOrder() 2 Restaurant Service validateAndPrice() - 3 Order Service updateSubtotal() - 4 Customer Service reserveCredit() releaseCredit() 5 Kitchen Service createTicket() 6 Order Service approveOrder() Can fail! Undo Lock Unlock Unlock Semantic lock countermeasure = Semantic ACID Can fail! Need to rollback
  • 30. @crichardson Saga coordination = sequencing of steps Choreography: distributed decision making vs. Orchestration: centralized decision making
  • 31. @crichardson Choreography-based Create Order Saga Order Created Credit Reserved Create Order Order state total … create() … Order events channel Customer events channel Order Service Customer Service Restaurant Service Restaurants events channel Order total calculated MenuItems Priced Ticket Created Kitchen Service Kitchen events channel Order credit reserved approve()
  • 32. @crichardson Order Service CreateOrderSaga orchestrator Restaurant Service Order state total… reserveCredit() CreateOrder Saga OrderService create() create() … Items Priced Restaurant command channel Saga reply channel Create Order Order ID Customer Service Customer command channel validateAndPrice() Credit Reserved updateSubtotal() Kitchen Service Kitchen command channel approve()
  • 33. @crichardson Bene fi ts and drawbacks of Sagas Dark energy repulsive forces Support multiple technology stacks ✅ Dark matter attractive forces Simple interactions ? Depends on command Prefer ACID over BASE ❌ Minimize runtime coupling ? Depends on command Ef fi cient inter-service communication ? Depends on command Minimize design time coupling ? Depends on command
  • 34. Force: Prefer ACID over BASE ❌ No automatic undo => extra work to implement compensating transactions Potential complexity of undoing changes to data that was changed by another transaction Create Order Saga Create Order Saga Order Service: createOrder() Customer Service: reserveCredit() Order Service: createOrder() Customer Service: reserveCredit() Kitchen Service: createTicket() Customer Service: releaseCredit() FAILS! Compensating transaction: • Undoes change to available credit • Fortunately: add/subtract commute Updates available credit
  • 35. Force: Prefer ACID over BASE ❌ Sagas are ACD - lack I = isolation => concurrent execution => potential data anomalies: Dirty reads Lost updates Fuzzy reads Must implement countermeasures = application- level ACID, e.g. Semantic lock Cancel Order Saga Create Order Saga Order Service: cancelOrder() Customer Service: releaseCredit() Order Service: createOrder() Customer Service: reserveCredit() Kitchen Service: createTicket() Customer Service: reserveCredit() Dirty read: Exceeds customer credit limit FAILS! Compensating transaction
  • 36. @crichardson Force: Minimize runtime coupling - depends on when response is sent Order Service createOrder() Order Created 1 Response 2 3 ✅ Order Service createOrder() Ticket Created 1 Response 7 8 Self-Contained Restaurant Service Customer Service Kitchen Service Tightly coupled ❌
  • 37. @crichardson Force: minimize design-time coupling Order Service Restaurant Service Customer Service Order Service Restaurant Service Customer Service Choreography Orchestration Participants depend on each other Orchestrator depends on participants Inappropriate knowledge of Orders? Simple API
  • 38. @crichardson Sagas are potentially complex BUT They can be simple It depends Order Service createOrder() Ful fi llment Service Order Created
  • 40. @crichardson Using a command-side replica Order Service createOrder() Restaurant Service Orders Restaurants Restaurant events Replica Validate and price line items without invoking Restaurant Service Restaurant MenuItem MenuItem createRestaurant()
  • 41. @crichardson Bene fi ts and drawbacks of Command-side replica Dark energy repulsive forces Support multiple technology stacks ✅ e.g. even different DBs Dark matter attractive forces Simple interactions ✅ Eliminates interaction with participant ❌ Other cmds must publish events Prefer ACID over BASE ❌ Risk of stale/inconsistent data Minimize runtime coupling ✅ Command does not interact with participant Ef fi cient inter-service communication ✅ Command is less distributed ❌ Cost of replication - storage + events Minimize design time coupling ? Risk of tightly coupling view to providers
  • 42. @crichardson Force: Minimize runtime coupling - non-local but self-contained operation Order Service createOrder() Orders Restaurants Response Outcome of validating and pricing line items https://microservices.io/patterns/decomposition/self-contained-service.html
  • 43. @crichardson Agenda Dark energy, dark matter and de fi ning a microservice architecture Overview of service collaboration patterns Designing system commands Designing system queries
  • 44. @crichardson Let’s imagine that you are implementing the fi ndOrder() query Service Operation Order Service Status of order: line items Kitchen Service Status of ticket: ready for pickup Delivery Service Status of delivery: ETA Accounting Service Status of payment: total including tax
  • 46. @crichardson API Composition pattern Order Service Order status Delivery Service Delivery Accounting Service Order status API Gateway GET /orders/id GET /orders?orderId=id GET /orders/id GET /deliveries?orderId=id status eta Kitchen Service Ticket status prepareBy GET /tickets?orderId=id {… response …} API Composer Providers Composer
  • 47. @crichardson Bene fi ts and drawbacks of API Composition Dark energy repulsive forces Support multiple technology stacks ✅ Dark matter attractive forces Simple interactions ? Possibility of many roundtrips Prefer ACID over BASE ❌ Multiple queries - potential for inconsistencies Minimize runtime coupling ❌ Use resiliency patterns (eg. Circuit breaker) to reduce impact Ef fi cient inter-service communication ? Parallelization can reduce latency Possibility of many roundtrips or large data transfers Minimize design time coupling ❌ Composer coupled to providers
  • 48. @crichardson Inef fi cient API composition: fi ndOrderHistory() Order Service Order status Delivery Service Delivery Accounting Service Order status API Gateway GET /orders? consumerId=abc& text=noodles&offset=ABC GET /orders? consumerId=abc& text=noodles&offset=ABC GET /deliveries? consumerId=abc& text=noodles&offset=ABC GET /orders? consumerId=abc& text=noodles&offset=ABC X X No line items for text search Different sort order status eta Order Line Item Composer
  • 50. @crichardson Implementing a query using CQRS Order Service Delivery Service Order events Delivery events fi ndOrderHistory() Order events channel Delivery events channel Order History Service Replica View Database https://microservices.io/patterns/data/cqrs.html … Service … events channel … events
  • 51. @crichardson Bene fi ts and drawbacks of CQRS Dark matter repulsive forces Support multiple technology stacks ✅ View DB different than Provider DBs Dark matter attractive forces Simple interactions ✅ Query is local ❌ Other cmds must publish events Prefer ACID over BASE ❌ Out of order events => Inconsistencies Minimize runtime coupling ✅ Ef fi cient inter-service communication ✅ Query is self-contained ❌ Cost of replication - storage + events Minimize design time coupling ? Risk of view being tightly coupled to providers
  • 52. @crichardson Summary: a microservice architecture must balance con fl icting forces Service Subdomain Subdomain Service Subdomain Subdomain Minimize dark energy repulsive forces Con fl icting Minimize dark matter attractive forces systemOperation() Minimize dark energy repulsive forces generates
  • 53. @crichardson Summary: design system operations using the collaboration patterns API Composition Provider Service Service query() Composer Provider Service Provider Service CQRS Provider Service Service query() View Provider Service Provider Service Event Event Event Service Service Service Transaction Compensating transaction Transaction Compensating transaction Transaction Compensating transaction command() Saga Service Service command() Replica Source Event Command-side replica Distributed ACID transactions X
  • 54. @crichardson Summary: Adjust service boundaries if dark matter forces cannot be suf fi ciently resolved