SlideShare una empresa de Scribd logo
1 de 46
Descargar para leer sin conexión
© Fraunhofer IESE
EVENTUAL CONSISTENCY
Du musst keine Angst haben…
Susanne Braun
25.01.2021
CyberLand Ladies Night
Oder doch?
© Fraunhofer IESE
2
Pat Helland
Database & Distributed Systems Guru
Architect of multiple transaction &
database systems (e.g. DynamoDB)
Worked at Microsoft, Amazon, SalesForce, …
“There is an interesting connection
between
fault tolerance, offlineable systems,
and the need for
application-based eventual
consistency.”
application-based eventual
consistency
fault tolerance, offlineable systems
Conference on Innovative Data Systems Research, 2009
© Fraunhofer IESE
3
“Correlating” Quality Attributes
Fault Tolerance Resilience
Loose Coupling
Availability
Scalability
Offline
Capability
Network
Partition
Tolerance
Low Latency
Responsiveness
© Fraunhofer IESE
4
Eric Brewer
Distributed Systems Researcher
Coined the CAP theorem, Contributed to
Spanner
Prof. emeritus University of California, Berkeley,
works now for Google
“But we forfeit C and I of ACID for
availability, graceful degradation and
performance.”
ACM Symposium on Principles of Distributed Computing, 2000
© Fraunhofer IESE
5
ACID vs. BASE
ACID BASE
Strong Consistency
(in the sense of one-copy-consistency)
Isolation
(in the sense of one-copy-serializability)
Pessimistic Synchronization
(global locks, synchronous update propagation)
Global Commits
(2PC, majority consensus, …)
Atomicity
Consistency
Isolation
Durability
Eventual Consistency
(stale data & approximate answers)
Availability
(top priority)
Optimistic Synchronization
(no locks, asynchronous update propagation)
Independent Local Commits
(conflict resolution, reconciliation, …)
Atomicity
Consistency
Isolation
Durability ?
Database is in a consistent state &
all invariants are being met!
This is about Concurrency Control!
This is about Convergence!
© Fraunhofer IESE
6
Consistency vs. Isolation
“Consistency tries to mask the distributed nature of the system”
“Isolation tries to mask the effects of concurrent execution”
Make it appear
as one system!
Make it appear I am the
only user of the system!
© Fraunhofer IESE
7
Douglas Terry
Distributed Systems Researcher
Coined the term Eventual Consistency in the
90ties
Former Prof. University of California, Berkeley,
worked for Microsoft, Samsung, AWS
“A system providing eventual
consistency guarantees that replicas
would eventually converge to a
mutually consistent state, i.e., to
identical contents, if update activity
ceased.”
Int. Conference on Parallel and Distributed Information Systems, 1994
© Fraunhofer IESE
8
Douglas Terry
Distributed Systems Researcher
Coined the term Eventual Consistency in the
90ties
Former Prof. University of California, Berkeley,
worked for Microsoft, Samsung, AWS
“A system providing eventual
consistency guarantees that replicas
would eventually converge to a
mutually consistent state, i.e., to
identical contents, if update activity
ceased.”
Int. Conference on Parallel and Distributed Information Systems, 1994
Pragmatic Definition
A system provides eventual consistency if:
(1)each update operation is eventually received by each
replica
(2)non-commutative update operations are performed
in the same order at each replica
(3)the outcome of a sequence of update operations is
the same at each replica (determinism)
Replicated Data Management for Mobile Computing, 2008
© Fraunhofer IESE
9
Eventual Consistency
Remember:
The only guarantee you get:
convergence to identical state
Outdated Data
Conflicts
Potential Concurrency Anomalies
Events / Operations coming out of order
Application needs to handle:
Huge source of human error!
© Fraunhofer IESE
10
Eventual Consistency
Remember:
You do not get any isolation guarantees like ‘Repeatable Read’
Hard to test
Issues emerge randomly in production
… are hard to reproduce
… are hard to debug
Application needs to handle concurrency control:
Huge source of human error!
© Fraunhofer IESE
11
Consistency in Non-Transactional Distributed Storage Systems
Source: ACM Computing Surveys, Vol. 49, No. 1, Article 19, 2016
© Fraunhofer IESE
12
Pat Helland
Database & Distributed Systems Guru
Architect of multiple transaction &
database systems (e.g. DynamoDB)
Worked at Microsoft, Amazon, SalesForce, …
“… it is time for us to move past the
examination of eventual consistency
in terms of updates and storage
systems. The real action comes when
examining application-based
operation semantics.”
in terms of Reads and Writes
application-based
operation semantics
in terms of updates and storage
Conference on Innovative Data Systems Research, 2009
eventual consistency
systems
© Fraunhofer IESE
13
Architecture Layers according to DDD
Infrastructure
Layer
Domain
Layer
Application
Layer
DB
:SELECT Statement
DB
:UPDATE Statement
Application Service
:Transaction Method
Domain Service
:Service Method
Aggregate Repository
:Query Method (findBy…)
Aggregate
:Command Method
DB
:BOT
DB
EOT
DIP
DIP
Low
level
Read
/
Write
Operations
Fine
Grained
Business
Operations
Coarse
Grained
Business
Operations
User Stories
Domain Operations
Data Replication
Goal
Business
Semantics
© Fraunhofer IESE
14
Recap Concurrency Control in Relational DBs
n A schedule of concurrent transactions is conflict-serializable iff the conflict graph is acyclic and
compatible with the execution order of the conflicting operations
Time
R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b)
Transactions T1, T2:
T1 T2
Conflict graph:
Conflict graph is cyclic
⇢ No conflict serializability
⇢ Schedule would be rejected
© Fraunhofer IESE
15
Business Semantics - Banking
t
R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b)
Withdraw(a)
T1
Deposit(b)
Withdraw(a) Deposit(b)
T2
© Fraunhofer IESE
16
Multilevel Transactions
(Weikum et al. 1992)
n If at each level the conflict serialization graph is acyclic then the multilevel schedule is in total
multilevel serializable
n Exploit semantics of operations in level-specific conflict relations that reflect the
commutativity / compatibility of operations
n Transactions are decomposed into operations and the operations again into sub-operations on
multiple levels
n Transactions, Business operations, Low-level read and write operations
n At each level a conflict relationship is defined
n read-write conflicts and write-write conflicts on the same data item conflict at the lowest level
n Non-commutative operations are conflicting on the level of business operations
In practice comparable to serializability!
Goal: Increase number of operations that can run concurrently!
© Fraunhofer IESE
17
Business Semantics - Banking
t
R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b)
Withdraw(a)
T1
Deposit(b)
Withdraw(a) Deposit(b)
T2
1
2
3
Low level Read
/ Write
Operations
Domain
Operations
Transactions
© Fraunhofer IESE
18
Multilevel Transactions Example
(Weikum et al. 1992)
t
R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b)
Withdraw(a)
T1
Deposit(b)
Withdraw(a) Deposit(b)
T2
Conflict graph at level
of domain operations:
Conflict graph at
level of transactions: ⌀
1
2
3
Low level Read
/ Write
Operations
Domain
Operations
Transactions
Withdraw(a) Withdraw(a)
Deposit(b) Deposit(b)
Conflict graph is acyclic at each level!
2 1
3 2
© Fraunhofer IESE
19
Architecture Layers according to DDD
Infrastructure
Layer
Domain
Layer
Application
Layer
Application Service
:Transaction Method
DB
:SELECT Statement
DB
:UPDATE Statement
Domain Service
:Service Method
Aggregate Repository
:Query Method (findBy…)
Aggregate
:Command Method
DB
:BOT
DB
EOT
DIP
DIP
Low
level
Read
/
Write
Operations
Fine
Grained
Business
Operations
Coarse
Grained
Business
Operations
Business
Semantics
User Stories
Domain Operations
Data Replication
Goal
© Fraunhofer IESE
20
Domain
Operation Design
© Fraunhofer IESE
21
Pat Helland
Database & Distributed Systems Guru
Architect of multiple transaction &
database systems (e.g. DynamoDB)
Worked at Microsoft, Amazon, SalesForce, …
Conference on Innovative Data Systems Research, 2009
A
C
I
D
2.0
Associative
Commutative
Idempotent
Distributed
(ab)c = a(bc)
ab = ba
aa = a
Operations
executed out
of order…
© Fraunhofer IESE
22
B
e
s
t
P
r
a
c
t
i
c
e
Popular Examples in Scientific Publications
Commutative Operations
o.domainOperation1(..)
o.domainOperation2(..)
=
o.domainOperation2(..)
o.domainOperaton1(..)
‘o’ is some
Aggregate / Entity / Domain Service
Counters - Integer Addition
Sets – Insert
Banking – Withdraw
Banking – Deposit
© Fraunhofer IESE
25
Annette Bieniusa
CRDT Guru
Co-Creator of AntidoteDB
Worked at INRIA with Marc
Shapiro, TU Kaiserslautern
© Fraunhofer IESE
26
CRDTs are grounded in algebraic
theories of monotonic semilattices
Conflict-Free Replicated Data Types (CRDTs)
CRDTs ship with
commutative merge operations
designed to be a
least upper bound (LUB)
of the conflicting operations.
Intuitive Example: Amazon’s Shopping Card*
Consider LUB as union of different object
states produced at different replicas
Shopping Card
- Soap
- Lotion
Shopping Card
- Lotion
- Brush
Merge
Shopping Card
- Soap
- Lotion
- Brush
Deleted items
might reappear
* Werner Vogels, Communications of the ACM, Volume 52, Issue 1, 2009
© Fraunhofer IESE
27
B
e
s
t
P
r
a
c
t
i
c
e
Incremental Operations
Example: ‘Incremental Operations’
List – Append
Note:
list.add(’a’)
list.add(‘b’)
!=
list.add(‘b’)
list.add(‘a’)
Text - Insert
Counters - Increment
Incremental Operations evaluate the
current state in order to derive the
updated value.
READ(state) WRITE(state)
Updating Domain
Operation
State Access
© Fraunhofer IESE
28
B
e
s
t
P
r
a
c
t
i
c
e
“Distributed” Operations
Concurrent operations can be executed in a
different order on different replicas.
Example: Concurrent operations
Domain Operations need the ability to
produce intended updates if executed on
different states on different replicas! Replica 1
Replica 2
Operation
Operation Operation
Operation
Operation
© Fraunhofer IESE
29
Collaborative Text Editing
Replica 1
Replica 2
insert(6, ‘r’)
insert(1, ‘e’) insert(2, ‘l’) insert(6, ‘r’)
“Hlo Wold”
“Hlo World”
“Helo Wold” “Hello Wold” “Hello rWold”
© Fraunhofer IESE
33
B
e
s
t
P
r
a
c
t
i
c
e
Beware of Domain Invariants
Model Domain Invariants explicitly! Examples:
Banking – Withdraw
withdraw(amount) {
…
assert(balance > dispoLimit)
}
Durability ?
© Fraunhofer IESE
34
Domain Data
Design
© Fraunhofer IESE
35
Pat Helland
Database & Distributed Systems Guru
Architect of multiple transaction &
database systems (e.g. DynamoDB)
Worked at Microsoft, Amazon, SalesForce, …
“Immutability Changes Everything”
ACM Queue, Volume 13, Issue 9, 2016
© Fraunhofer IESE
36
C
l
a
s
s
i
f
i
c
a
t
i
o
n
1st Level Classification of Replicated Aggregates
Mutable ?
Observed
Aggregates*
No
Concurrent In-Place Updates ?
Yes
No
Derived
Aggregates*
Multiple Updaters ?
Yes
Dedicated
Aggregates
Nontrivial
Aggregates
Yes
No
* “Append-Only Computing” – Helland 2015
Observed Aggregates:
• Time series data (machine
sensor data, market data, …)
• Domain events
Derived Aggregates:
• Machine generated data
(recommendations, …)
• Timeline or newsfeed data
Dedicated Aggregates:
• User generated data (reviews,
social media posts, ...)
• Dedicated master data (user
profiles, account settings)
E x a m p l e s
© Fraunhofer IESE
37
C
l
a
s
s
i
f
i
c
a
t
i
o
n
2nd Level Classification of Nontrivial Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Reference Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
Update Frequency in
Peak Times
Update Simultaneity in
Peak Times
Concurrency Anomaly
Probability
low improbable low
-
Nontrivial
Aggregates
Reference Aggregates Examples:
• Master data (CRM data, resources, products, …)
• Values (Valid currencies, product types, gender, …)
• Meta data (Tags, descrtiptive data of raw data, ..)
© Fraunhofer IESE
38
C
l
a
s
s
i
f
i
c
a
t
i
o
n
2nd Level Classification of Nontrivial Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Reference Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
Update Frequency in
Peak Times
Update Simultaneity in
Peak Times
Concurrency Anomaly
Probability
low
high
improbable
probable
low
high
-
Nontrivial
Aggregates
Reference Aggregates Examples:
• Master data (CRM data, resources, products, …)
• Values (Valid currencies, product types, gender, …)
• Meta data (Tags, descrtiptive data of raw data, ..)
Activity Aggregates Examples:
• State data of workflows, business processes, …
• Coordination data of joint activities (agricultural
field operation, meeting, …)
• Task management data, Kanban board data, …
© Fraunhofer IESE
39
C
l
a
s
s
i
f
i
c
a
t
i
o
n
2nd Level Classification of Nontrivial Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Reference Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
Update Frequency in
Peak Times
Update Simultaneity in
Peak Times
Concurrency Anomaly
Probability
low
high
very high
improbable
probable
highly probable
low
high
very high
-
Nontrivial
Aggregates
Reference Aggregates Examples:
• Master data (CRM data, resources, products, …)
• Values (Valid currencies, product types, gender, …)
• Meta data (Tags, descrtiptive data of raw data, ..)
Activity Aggregates Examples:
• State data of workflows, business processes, …
• Coordination data of joint activities (agricultural
field operation, meeting, …)
• Task management data, Kanban board data, …
Collaboration Result Aggregates Examples:
• Result data of collaborative knowledge work (CAD
model, crop rotation plan, whiteboard diagram, …)
• Text data as result of collaborative authorship
(manuals, scientific papers, meeting protocols, …)
© Fraunhofer IESE
40
C
l
a
s
s
i
f
i
c
a
t
i
o
n
2nd Level Classification of Nontrivial Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Reference Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
Update Frequency in
Peak Times
Update Simultaneity in
Peak Times
Concurrency Anomaly
Probability
“Technical Immutability Border”
low
high
very high
improbable
probable
highly probable
low
high
very high
- low
improbable
Nontrivial
Aggregates
© Fraunhofer IESE
41
Eventual Consistency
is standard
Estimation - Frequency of Distribution
Trad. Enterprise IS
(ERP, CRM, Workflow Management)
Social Media Apps
(Facebook, Twitter)
Next Data-Intensive Systems
(Smart Farming, Industrie 4.0)
30%
30%
9 % 45%
4%
1%
20%
20%
20%
20%
“Technical
Immutability
Border”
Reference Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
1 % 50% 20%
30 %
© Fraunhofer IESE
42
B
e
s
t
P
r
a
c
t
i
c
e
Concurrency Anomalies Impact Assessment
Concurrency Anomaly
Probability
Fixing Costs of
Data Corruption
low
high
very high
very high
high
very high
moderate
very high
moderate
Reference Aggregates
Activity Aggregates
Collaboration Result
Aggregates
Dedicated Aggregates
Derived Aggregates
Observed Aggregates
low
Consequences of
Data Corruption
critical
major
critical
minor
depends
critical
Nontrivial
Aggregates
“Technical Immutability Border”
Trivial
Aggregates
A Classification of Replicated Data for the Design of Eventually Consistent Domain Models,
S. Braun, S. Dessloch, ICSA 2020
© Fraunhofer IESE
43
Trivial Aggregates First
n Whenever feasible, model aggregates as trivial aggregates*
B
e
s
t
P
r
a
c
t
i
c
e
P a t t e r n
A n t i - P a t t e r n
StockItems
StockItem
productId: String
number: int
1..*
1
In-place Updates
Nontrivial Activity Aggregate
GoodsReceiepts
OrderConfirmations
Observed Aggregates
StockItems
StockItem
productId: String
number: int
1
Derived Aggregate
Calculated
periodically or
on demand
Technical
Immutability
1..*
* See also: Event Sourcing & CQRS (Command Query Responsibility Segregation)
© Fraunhofer IESE
44
Dedicated Aggregates are Solitary
n Design dedicated data as self-contained aggregate
B
e
s
t
P
r
a
c
t
i
c
e
P a t t e r n
A n t i - P a t t e r n
Operation
Field Assignment DocumentationRecords
DocRecord
1..*
1
Nontrivial Activity Aggregate
Dedicated to single
user
Operation
Field Assignment
DocumentationRecords
DocRecord
1..*
1
Nontrivial Activity Aggregate
Cross-aggregate
reference
Dedicated Aggregate
1..* 1..* 1
1
1 1
1
1
1..* 1..*
© Fraunhofer IESE
45
Separation of Aggregate Classes
n Whenever feasible, keep data of different classes in separate aggregates
B
e
s
t
P
r
a
c
t
i
c
e
P a t t e r n
A n t i - P a t t e r n
Operation
Field Assignment
Nontrivial Activity Aggregate
Reference data that
is rarely updated
Operation
Field
Assignment
Nontrivial Activity Aggregate
Reference
Aggregate
Cross-aggregate reference
1..*
1..*
1..*
1
1
1
© Fraunhofer IESE
46
Derived Aggregates are idempotent
n The calculation of the state of a derived aggregate should be idempotent & deterministic
B
e
s
t
P
r
a
c
t
i
c
e
© Fraunhofer IESE
47
Do not Forget the Master
n Consider using Primary Copy Replication, if transactional guarantees are required
B
e
s
t
P
r
a
c
t
i
c
e
P a t t e r n
A n t i - P a t t e r n
Update Everywhere
Primary Copy
A
A
A
A
A A
<
A
Update Update Update Update
Update
Update
Update
A
A
A
A
A A
<
A
Update
© Fraunhofer IESE
48
Future Work
n ECD3 – Eventually Consistent Domain Driven Design
n Best Practices & Software Architecture Design Guidelines
n Framework Towards Multilevel Transactions
n Action Research Study
n Workshops with Practitioners
EventuallyConsistentDDD/design-guidelines
We’ re on
Github!
© Fraunhofer IESE
49
Action Research
© Fraunhofer IESE
50
Digitale Teams - Team Dashboard
© Fraunhofer IESE
51
#Thanx
#StayHome
Fraunhofer IESE, Kaiserslautern
Susanne Braun
Software Developer & Architect
susanne.braun@iese.fraunhofer.de
@susannebraun
EventuallyConsistentDDD/design-guidelines

Más contenido relacionado

La actualidad más candente

Chapter on Book on Cloud Computing 96
Chapter on Book on Cloud Computing 96Chapter on Book on Cloud Computing 96
Chapter on Book on Cloud Computing 96Michele Cermele
 
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...Yahoo Developer Network
 
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHM
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHMPROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHM
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHMecij
 
Comparing reinforcement learning and access points with rowel
Comparing reinforcement learning and access points with rowelComparing reinforcement learning and access points with rowel
Comparing reinforcement learning and access points with rowelijcseit
 

La actualidad más candente (7)

Chapter on Book on Cloud Computing 96
Chapter on Book on Cloud Computing 96Chapter on Book on Cloud Computing 96
Chapter on Book on Cloud Computing 96
 
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...
Apache Hadoop India Summit 2011 Keynote talk "Programming Abstractions for Sm...
 
Todtree
TodtreeTodtree
Todtree
 
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHM
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHMPROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHM
PROCESS OF LOAD BALANCING IN CLOUD COMPUTING USING GENETIC ALGORITHM
 
Comparing reinforcement learning and access points with rowel
Comparing reinforcement learning and access points with rowelComparing reinforcement learning and access points with rowel
Comparing reinforcement learning and access points with rowel
 
Ch1
Ch1Ch1
Ch1
 
60
6060
60
 

Similar a Eventual Consistency - Du musst keine Angst haben

w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdf
w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdfw-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdf
w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdfSusanne Braun
 
documents.pub_replication-consistency.ppt
documents.pub_replication-consistency.pptdocuments.pub_replication-consistency.ppt
documents.pub_replication-consistency.pptwondefirawwolile
 
Parallel Computing 2007: Overview
Parallel Computing 2007: OverviewParallel Computing 2007: Overview
Parallel Computing 2007: OverviewGeoffrey Fox
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Software engineering
Software engineeringSoftware engineering
Software engineeringFahe Em
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowKaxil Naik
 
CS 542 Parallel DBs, NoSQL, MapReduce
CS 542 Parallel DBs, NoSQL, MapReduceCS 542 Parallel DBs, NoSQL, MapReduce
CS 542 Parallel DBs, NoSQL, MapReduceJ Singh
 
Integration Patterns for Big Data Applications
Integration Patterns for Big Data ApplicationsIntegration Patterns for Big Data Applications
Integration Patterns for Big Data ApplicationsMichael Häusler
 
Keeping CALM – Konsistenz in verteilten Systemen leichtgemacht
Keeping CALM – Konsistenz in verteilten Systemen leichtgemachtKeeping CALM – Konsistenz in verteilten Systemen leichtgemacht
Keeping CALM – Konsistenz in verteilten Systemen leichtgemachtSusanne Braun
 
Apache Kafka® and the Data Mesh
Apache Kafka® and the Data MeshApache Kafka® and the Data Mesh
Apache Kafka® and the Data MeshConfluentInc1
 
Swift Parallel Scripting for High-Performance Workflow
Swift Parallel Scripting for High-Performance WorkflowSwift Parallel Scripting for High-Performance Workflow
Swift Parallel Scripting for High-Performance WorkflowDaniel S. Katz
 
DB2 for z/O S Data Sharing
DB2 for z/O S  Data  SharingDB2 for z/O S  Data  Sharing
DB2 for z/O S Data SharingSurekha Parekh
 
Architecting for the public and the private cloud
Architecting for the public and the private cloudArchitecting for the public and the private cloud
Architecting for the public and the private cloudHammad Rajjoub
 
Graph Data: a New Data Management Frontier
Graph Data: a New Data Management FrontierGraph Data: a New Data Management Frontier
Graph Data: a New Data Management FrontierDemai Ni
 
Bhupeshbansal bigdata
Bhupeshbansal bigdata Bhupeshbansal bigdata
Bhupeshbansal bigdata Bhupesh Bansal
 
"Taming the Dragon": Data Flow Programming with Zenoh-Flow
"Taming the Dragon": Data Flow Programming with Zenoh-Flow"Taming the Dragon": Data Flow Programming with Zenoh-Flow
"Taming the Dragon": Data Flow Programming with Zenoh-FlowZettaScaleTechnology
 
Data Engineering for Data Scientists
Data Engineering for Data Scientists Data Engineering for Data Scientists
Data Engineering for Data Scientists jlacefie
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2Techglyphs
 

Similar a Eventual Consistency - Du musst keine Angst haben (20)

w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdf
w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdfw-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdf
w-jax 2022: Eventual-Consistency-Du-musst-keine-Angst-haben-Final.pdf
 
documents.pub_replication-consistency.ppt
documents.pub_replication-consistency.pptdocuments.pub_replication-consistency.ppt
documents.pub_replication-consistency.ppt
 
Parallel Computing 2007: Overview
Parallel Computing 2007: OverviewParallel Computing 2007: Overview
Parallel Computing 2007: Overview
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Software engineering
Software engineeringSoftware engineering
Software engineering
 
Building and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache AirflowBuilding and deploying LLM applications with Apache Airflow
Building and deploying LLM applications with Apache Airflow
 
CS 542 Parallel DBs, NoSQL, MapReduce
CS 542 Parallel DBs, NoSQL, MapReduceCS 542 Parallel DBs, NoSQL, MapReduce
CS 542 Parallel DBs, NoSQL, MapReduce
 
Integration Patterns for Big Data Applications
Integration Patterns for Big Data ApplicationsIntegration Patterns for Big Data Applications
Integration Patterns for Big Data Applications
 
Keeping CALM – Konsistenz in verteilten Systemen leichtgemacht
Keeping CALM – Konsistenz in verteilten Systemen leichtgemachtKeeping CALM – Konsistenz in verteilten Systemen leichtgemacht
Keeping CALM – Konsistenz in verteilten Systemen leichtgemacht
 
Apache Kafka® and the Data Mesh
Apache Kafka® and the Data MeshApache Kafka® and the Data Mesh
Apache Kafka® and the Data Mesh
 
Machine Learning and Deep Software Variability
Machine Learning and Deep Software VariabilityMachine Learning and Deep Software Variability
Machine Learning and Deep Software Variability
 
Swift Parallel Scripting for High-Performance Workflow
Swift Parallel Scripting for High-Performance WorkflowSwift Parallel Scripting for High-Performance Workflow
Swift Parallel Scripting for High-Performance Workflow
 
DB2 for z/O S Data Sharing
DB2 for z/O S  Data  SharingDB2 for z/O S  Data  Sharing
DB2 for z/O S Data Sharing
 
Architecting for the public and the private cloud
Architecting for the public and the private cloudArchitecting for the public and the private cloud
Architecting for the public and the private cloud
 
Graph Data: a New Data Management Frontier
Graph Data: a New Data Management FrontierGraph Data: a New Data Management Frontier
Graph Data: a New Data Management Frontier
 
Bhupeshbansal bigdata
Bhupeshbansal bigdata Bhupeshbansal bigdata
Bhupeshbansal bigdata
 
Interoperability
InteroperabilityInteroperability
Interoperability
 
"Taming the Dragon": Data Flow Programming with Zenoh-Flow
"Taming the Dragon": Data Flow Programming with Zenoh-Flow"Taming the Dragon": Data Flow Programming with Zenoh-Flow
"Taming the Dragon": Data Flow Programming with Zenoh-Flow
 
Data Engineering for Data Scientists
Data Engineering for Data Scientists Data Engineering for Data Scientists
Data Engineering for Data Scientists
 
Bt0066 database management system2
Bt0066 database management system2Bt0066 database management system2
Bt0066 database management system2
 

Último

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceanilsa9823
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 

Último (20)

5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 

Eventual Consistency - Du musst keine Angst haben

  • 1. © Fraunhofer IESE EVENTUAL CONSISTENCY Du musst keine Angst haben… Susanne Braun 25.01.2021 CyberLand Ladies Night Oder doch?
  • 2. © Fraunhofer IESE 2 Pat Helland Database & Distributed Systems Guru Architect of multiple transaction & database systems (e.g. DynamoDB) Worked at Microsoft, Amazon, SalesForce, … “There is an interesting connection between fault tolerance, offlineable systems, and the need for application-based eventual consistency.” application-based eventual consistency fault tolerance, offlineable systems Conference on Innovative Data Systems Research, 2009
  • 3. © Fraunhofer IESE 3 “Correlating” Quality Attributes Fault Tolerance Resilience Loose Coupling Availability Scalability Offline Capability Network Partition Tolerance Low Latency Responsiveness
  • 4. © Fraunhofer IESE 4 Eric Brewer Distributed Systems Researcher Coined the CAP theorem, Contributed to Spanner Prof. emeritus University of California, Berkeley, works now for Google “But we forfeit C and I of ACID for availability, graceful degradation and performance.” ACM Symposium on Principles of Distributed Computing, 2000
  • 5. © Fraunhofer IESE 5 ACID vs. BASE ACID BASE Strong Consistency (in the sense of one-copy-consistency) Isolation (in the sense of one-copy-serializability) Pessimistic Synchronization (global locks, synchronous update propagation) Global Commits (2PC, majority consensus, …) Atomicity Consistency Isolation Durability Eventual Consistency (stale data & approximate answers) Availability (top priority) Optimistic Synchronization (no locks, asynchronous update propagation) Independent Local Commits (conflict resolution, reconciliation, …) Atomicity Consistency Isolation Durability ? Database is in a consistent state & all invariants are being met! This is about Concurrency Control! This is about Convergence!
  • 6. © Fraunhofer IESE 6 Consistency vs. Isolation “Consistency tries to mask the distributed nature of the system” “Isolation tries to mask the effects of concurrent execution” Make it appear as one system! Make it appear I am the only user of the system!
  • 7. © Fraunhofer IESE 7 Douglas Terry Distributed Systems Researcher Coined the term Eventual Consistency in the 90ties Former Prof. University of California, Berkeley, worked for Microsoft, Samsung, AWS “A system providing eventual consistency guarantees that replicas would eventually converge to a mutually consistent state, i.e., to identical contents, if update activity ceased.” Int. Conference on Parallel and Distributed Information Systems, 1994
  • 8. © Fraunhofer IESE 8 Douglas Terry Distributed Systems Researcher Coined the term Eventual Consistency in the 90ties Former Prof. University of California, Berkeley, worked for Microsoft, Samsung, AWS “A system providing eventual consistency guarantees that replicas would eventually converge to a mutually consistent state, i.e., to identical contents, if update activity ceased.” Int. Conference on Parallel and Distributed Information Systems, 1994 Pragmatic Definition A system provides eventual consistency if: (1)each update operation is eventually received by each replica (2)non-commutative update operations are performed in the same order at each replica (3)the outcome of a sequence of update operations is the same at each replica (determinism) Replicated Data Management for Mobile Computing, 2008
  • 9. © Fraunhofer IESE 9 Eventual Consistency Remember: The only guarantee you get: convergence to identical state Outdated Data Conflicts Potential Concurrency Anomalies Events / Operations coming out of order Application needs to handle: Huge source of human error!
  • 10. © Fraunhofer IESE 10 Eventual Consistency Remember: You do not get any isolation guarantees like ‘Repeatable Read’ Hard to test Issues emerge randomly in production … are hard to reproduce … are hard to debug Application needs to handle concurrency control: Huge source of human error!
  • 11. © Fraunhofer IESE 11 Consistency in Non-Transactional Distributed Storage Systems Source: ACM Computing Surveys, Vol. 49, No. 1, Article 19, 2016
  • 12. © Fraunhofer IESE 12 Pat Helland Database & Distributed Systems Guru Architect of multiple transaction & database systems (e.g. DynamoDB) Worked at Microsoft, Amazon, SalesForce, … “… it is time for us to move past the examination of eventual consistency in terms of updates and storage systems. The real action comes when examining application-based operation semantics.” in terms of Reads and Writes application-based operation semantics in terms of updates and storage Conference on Innovative Data Systems Research, 2009 eventual consistency systems
  • 13. © Fraunhofer IESE 13 Architecture Layers according to DDD Infrastructure Layer Domain Layer Application Layer DB :SELECT Statement DB :UPDATE Statement Application Service :Transaction Method Domain Service :Service Method Aggregate Repository :Query Method (findBy…) Aggregate :Command Method DB :BOT DB EOT DIP DIP Low level Read / Write Operations Fine Grained Business Operations Coarse Grained Business Operations User Stories Domain Operations Data Replication Goal Business Semantics
  • 14. © Fraunhofer IESE 14 Recap Concurrency Control in Relational DBs n A schedule of concurrent transactions is conflict-serializable iff the conflict graph is acyclic and compatible with the execution order of the conflicting operations Time R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b) Transactions T1, T2: T1 T2 Conflict graph: Conflict graph is cyclic ⇢ No conflict serializability ⇢ Schedule would be rejected
  • 15. © Fraunhofer IESE 15 Business Semantics - Banking t R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b) Withdraw(a) T1 Deposit(b) Withdraw(a) Deposit(b) T2
  • 16. © Fraunhofer IESE 16 Multilevel Transactions (Weikum et al. 1992) n If at each level the conflict serialization graph is acyclic then the multilevel schedule is in total multilevel serializable n Exploit semantics of operations in level-specific conflict relations that reflect the commutativity / compatibility of operations n Transactions are decomposed into operations and the operations again into sub-operations on multiple levels n Transactions, Business operations, Low-level read and write operations n At each level a conflict relationship is defined n read-write conflicts and write-write conflicts on the same data item conflict at the lowest level n Non-commutative operations are conflicting on the level of business operations In practice comparable to serializability! Goal: Increase number of operations that can run concurrently!
  • 17. © Fraunhofer IESE 17 Business Semantics - Banking t R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b) Withdraw(a) T1 Deposit(b) Withdraw(a) Deposit(b) T2 1 2 3 Low level Read / Write Operations Domain Operations Transactions
  • 18. © Fraunhofer IESE 18 Multilevel Transactions Example (Weikum et al. 1992) t R(a) W(a) R(a) W(a) R(b) W(b) R(b) W(b) Withdraw(a) T1 Deposit(b) Withdraw(a) Deposit(b) T2 Conflict graph at level of domain operations: Conflict graph at level of transactions: ⌀ 1 2 3 Low level Read / Write Operations Domain Operations Transactions Withdraw(a) Withdraw(a) Deposit(b) Deposit(b) Conflict graph is acyclic at each level! 2 1 3 2
  • 19. © Fraunhofer IESE 19 Architecture Layers according to DDD Infrastructure Layer Domain Layer Application Layer Application Service :Transaction Method DB :SELECT Statement DB :UPDATE Statement Domain Service :Service Method Aggregate Repository :Query Method (findBy…) Aggregate :Command Method DB :BOT DB EOT DIP DIP Low level Read / Write Operations Fine Grained Business Operations Coarse Grained Business Operations Business Semantics User Stories Domain Operations Data Replication Goal
  • 21. © Fraunhofer IESE 21 Pat Helland Database & Distributed Systems Guru Architect of multiple transaction & database systems (e.g. DynamoDB) Worked at Microsoft, Amazon, SalesForce, … Conference on Innovative Data Systems Research, 2009 A C I D 2.0 Associative Commutative Idempotent Distributed (ab)c = a(bc) ab = ba aa = a Operations executed out of order…
  • 22. © Fraunhofer IESE 22 B e s t P r a c t i c e Popular Examples in Scientific Publications Commutative Operations o.domainOperation1(..) o.domainOperation2(..) = o.domainOperation2(..) o.domainOperaton1(..) ‘o’ is some Aggregate / Entity / Domain Service Counters - Integer Addition Sets – Insert Banking – Withdraw Banking – Deposit
  • 23. © Fraunhofer IESE 25 Annette Bieniusa CRDT Guru Co-Creator of AntidoteDB Worked at INRIA with Marc Shapiro, TU Kaiserslautern
  • 24. © Fraunhofer IESE 26 CRDTs are grounded in algebraic theories of monotonic semilattices Conflict-Free Replicated Data Types (CRDTs) CRDTs ship with commutative merge operations designed to be a least upper bound (LUB) of the conflicting operations. Intuitive Example: Amazon’s Shopping Card* Consider LUB as union of different object states produced at different replicas Shopping Card - Soap - Lotion Shopping Card - Lotion - Brush Merge Shopping Card - Soap - Lotion - Brush Deleted items might reappear * Werner Vogels, Communications of the ACM, Volume 52, Issue 1, 2009
  • 25. © Fraunhofer IESE 27 B e s t P r a c t i c e Incremental Operations Example: ‘Incremental Operations’ List – Append Note: list.add(’a’) list.add(‘b’) != list.add(‘b’) list.add(‘a’) Text - Insert Counters - Increment Incremental Operations evaluate the current state in order to derive the updated value. READ(state) WRITE(state) Updating Domain Operation State Access
  • 26. © Fraunhofer IESE 28 B e s t P r a c t i c e “Distributed” Operations Concurrent operations can be executed in a different order on different replicas. Example: Concurrent operations Domain Operations need the ability to produce intended updates if executed on different states on different replicas! Replica 1 Replica 2 Operation Operation Operation Operation Operation
  • 27. © Fraunhofer IESE 29 Collaborative Text Editing Replica 1 Replica 2 insert(6, ‘r’) insert(1, ‘e’) insert(2, ‘l’) insert(6, ‘r’) “Hlo Wold” “Hlo World” “Helo Wold” “Hello Wold” “Hello rWold”
  • 28. © Fraunhofer IESE 33 B e s t P r a c t i c e Beware of Domain Invariants Model Domain Invariants explicitly! Examples: Banking – Withdraw withdraw(amount) { … assert(balance > dispoLimit) } Durability ?
  • 30. © Fraunhofer IESE 35 Pat Helland Database & Distributed Systems Guru Architect of multiple transaction & database systems (e.g. DynamoDB) Worked at Microsoft, Amazon, SalesForce, … “Immutability Changes Everything” ACM Queue, Volume 13, Issue 9, 2016
  • 31. © Fraunhofer IESE 36 C l a s s i f i c a t i o n 1st Level Classification of Replicated Aggregates Mutable ? Observed Aggregates* No Concurrent In-Place Updates ? Yes No Derived Aggregates* Multiple Updaters ? Yes Dedicated Aggregates Nontrivial Aggregates Yes No * “Append-Only Computing” – Helland 2015 Observed Aggregates: • Time series data (machine sensor data, market data, …) • Domain events Derived Aggregates: • Machine generated data (recommendations, …) • Timeline or newsfeed data Dedicated Aggregates: • User generated data (reviews, social media posts, ...) • Dedicated master data (user profiles, account settings) E x a m p l e s
  • 32. © Fraunhofer IESE 37 C l a s s i f i c a t i o n 2nd Level Classification of Nontrivial Aggregates Activity Aggregates Collaboration Result Aggregates Reference Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates Update Frequency in Peak Times Update Simultaneity in Peak Times Concurrency Anomaly Probability low improbable low - Nontrivial Aggregates Reference Aggregates Examples: • Master data (CRM data, resources, products, …) • Values (Valid currencies, product types, gender, …) • Meta data (Tags, descrtiptive data of raw data, ..)
  • 33. © Fraunhofer IESE 38 C l a s s i f i c a t i o n 2nd Level Classification of Nontrivial Aggregates Activity Aggregates Collaboration Result Aggregates Reference Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates Update Frequency in Peak Times Update Simultaneity in Peak Times Concurrency Anomaly Probability low high improbable probable low high - Nontrivial Aggregates Reference Aggregates Examples: • Master data (CRM data, resources, products, …) • Values (Valid currencies, product types, gender, …) • Meta data (Tags, descrtiptive data of raw data, ..) Activity Aggregates Examples: • State data of workflows, business processes, … • Coordination data of joint activities (agricultural field operation, meeting, …) • Task management data, Kanban board data, …
  • 34. © Fraunhofer IESE 39 C l a s s i f i c a t i o n 2nd Level Classification of Nontrivial Aggregates Activity Aggregates Collaboration Result Aggregates Reference Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates Update Frequency in Peak Times Update Simultaneity in Peak Times Concurrency Anomaly Probability low high very high improbable probable highly probable low high very high - Nontrivial Aggregates Reference Aggregates Examples: • Master data (CRM data, resources, products, …) • Values (Valid currencies, product types, gender, …) • Meta data (Tags, descrtiptive data of raw data, ..) Activity Aggregates Examples: • State data of workflows, business processes, … • Coordination data of joint activities (agricultural field operation, meeting, …) • Task management data, Kanban board data, … Collaboration Result Aggregates Examples: • Result data of collaborative knowledge work (CAD model, crop rotation plan, whiteboard diagram, …) • Text data as result of collaborative authorship (manuals, scientific papers, meeting protocols, …)
  • 35. © Fraunhofer IESE 40 C l a s s i f i c a t i o n 2nd Level Classification of Nontrivial Aggregates Activity Aggregates Collaboration Result Aggregates Reference Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates Update Frequency in Peak Times Update Simultaneity in Peak Times Concurrency Anomaly Probability “Technical Immutability Border” low high very high improbable probable highly probable low high very high - low improbable Nontrivial Aggregates
  • 36. © Fraunhofer IESE 41 Eventual Consistency is standard Estimation - Frequency of Distribution Trad. Enterprise IS (ERP, CRM, Workflow Management) Social Media Apps (Facebook, Twitter) Next Data-Intensive Systems (Smart Farming, Industrie 4.0) 30% 30% 9 % 45% 4% 1% 20% 20% 20% 20% “Technical Immutability Border” Reference Aggregates Activity Aggregates Collaboration Result Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates 1 % 50% 20% 30 %
  • 37. © Fraunhofer IESE 42 B e s t P r a c t i c e Concurrency Anomalies Impact Assessment Concurrency Anomaly Probability Fixing Costs of Data Corruption low high very high very high high very high moderate very high moderate Reference Aggregates Activity Aggregates Collaboration Result Aggregates Dedicated Aggregates Derived Aggregates Observed Aggregates low Consequences of Data Corruption critical major critical minor depends critical Nontrivial Aggregates “Technical Immutability Border” Trivial Aggregates A Classification of Replicated Data for the Design of Eventually Consistent Domain Models, S. Braun, S. Dessloch, ICSA 2020
  • 38. © Fraunhofer IESE 43 Trivial Aggregates First n Whenever feasible, model aggregates as trivial aggregates* B e s t P r a c t i c e P a t t e r n A n t i - P a t t e r n StockItems StockItem productId: String number: int 1..* 1 In-place Updates Nontrivial Activity Aggregate GoodsReceiepts OrderConfirmations Observed Aggregates StockItems StockItem productId: String number: int 1 Derived Aggregate Calculated periodically or on demand Technical Immutability 1..* * See also: Event Sourcing & CQRS (Command Query Responsibility Segregation)
  • 39. © Fraunhofer IESE 44 Dedicated Aggregates are Solitary n Design dedicated data as self-contained aggregate B e s t P r a c t i c e P a t t e r n A n t i - P a t t e r n Operation Field Assignment DocumentationRecords DocRecord 1..* 1 Nontrivial Activity Aggregate Dedicated to single user Operation Field Assignment DocumentationRecords DocRecord 1..* 1 Nontrivial Activity Aggregate Cross-aggregate reference Dedicated Aggregate 1..* 1..* 1 1 1 1 1 1 1..* 1..*
  • 40. © Fraunhofer IESE 45 Separation of Aggregate Classes n Whenever feasible, keep data of different classes in separate aggregates B e s t P r a c t i c e P a t t e r n A n t i - P a t t e r n Operation Field Assignment Nontrivial Activity Aggregate Reference data that is rarely updated Operation Field Assignment Nontrivial Activity Aggregate Reference Aggregate Cross-aggregate reference 1..* 1..* 1..* 1 1 1
  • 41. © Fraunhofer IESE 46 Derived Aggregates are idempotent n The calculation of the state of a derived aggregate should be idempotent & deterministic B e s t P r a c t i c e
  • 42. © Fraunhofer IESE 47 Do not Forget the Master n Consider using Primary Copy Replication, if transactional guarantees are required B e s t P r a c t i c e P a t t e r n A n t i - P a t t e r n Update Everywhere Primary Copy A A A A A A < A Update Update Update Update Update Update Update A A A A A A < A Update
  • 43. © Fraunhofer IESE 48 Future Work n ECD3 – Eventually Consistent Domain Driven Design n Best Practices & Software Architecture Design Guidelines n Framework Towards Multilevel Transactions n Action Research Study n Workshops with Practitioners EventuallyConsistentDDD/design-guidelines We’ re on Github!
  • 45. © Fraunhofer IESE 50 Digitale Teams - Team Dashboard
  • 46. © Fraunhofer IESE 51 #Thanx #StayHome Fraunhofer IESE, Kaiserslautern Susanne Braun Software Developer & Architect susanne.braun@iese.fraunhofer.de @susannebraun EventuallyConsistentDDD/design-guidelines