7. Event sourcing
Capture all changes to application
state as sequence of events
Store events in event log (append-
only)
Replay events to recover application
state
24. Abstractions
Command side Query side
Akka
Persistence
PersistentActor
PersistentView
Source[E,M]
Eventuate EventsourcedActor
EventsourcedView
EventsourcedProcessor
Source[E,M]
*) work in progress
32. Consistency
Akka Persistence and Eventuate
support strong consistency
Eventuate additionally supports
relaxation to causal consistency
33. Akka Persistence
Enforces strong consistency on
command side
PersistentActors must be global
singletons
No actor/state replication
34. Eventuate
EventsourcedActors can be replicated
State replication via reliable,
asynchronous event replication
Replication across locations
(availability zones)
59. Eventuate
Strong consistency within location*)
Causal consistency across locations
Causality is tracked with vector
clocks
*) relaxation to causal consistency also possible within location
64. FIFO rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Alice
DC1
DC2
DC3
65. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Alice
- Alice: Whew, found it upstairs
DC1
DC2
DC3
FIFO rel. broadcast
66. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Alice
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
DC1
DC2
DC3
FIFO rel. broadcast
67. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Alice
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
DC1
DC2
DC3
FIFO rel. broadcast
68. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
DC1
DC2
DC3
FIFO rel. broadcast
69. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
DC1
DC2
DC3
FIFO rel. broadcast
70. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
DC1
DC2
DC3
Bob
FIFO rel. broadcast
71. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
DC1
DC2
DC3
FIFO rel. broadcast
Causality violation!
72. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Alice: Whew, found it upstairs
DC1
DC2
DC3
FIFO rel. broadcast
Retry
Causality violation!
73. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
DC1
DC2
DC3
74. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
DC1
DC2
DC3
75. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
Causality
check
DC1
DC2
DC3
76. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Causality
check
DC1
DC2
DC3
77. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Causality
check
Causality
check
DC1
DC2
DC3
78. Causal rel. broadcast
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
Bob
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Buffer
Causality
check
Causality
check
DC1
DC2
DC3
79. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Buffer
Causality
check
Retry
DC1
DC2
DC3
Causal rel. broadcast
80. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Buffer
Causality
check
- Alice: Whew, found it upstairs
Retry
DC1
DC2
DC3
Causal rel. broadcast
81. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
Buffer
Causality
check
- Bob: I’m glad to hear that
- Alice: Whew, found it upstairs
Retry
DC1
DC2
DC3
Causal rel. broadcast
82. - Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Lost my wedding ring
- Alice: Whew, found it upstairs
- Alice: Whew, found it upstairs
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Bob: I’m glad to hear that
- Alice: Whew, found it upstairs
Causal re-ordering
DC1
DC2
DC3
Causal rel. broadcast
83. Causal consistency
Causally related events are
delivered in same order at all
locations
Concurrent events can be delivered
in any order at different locations
87. Local event log
Storage order consistent with
causal order
Given the potential causality
relation ➞ of events
Local event logs are linear
extensions of ➞
88. Replicated event log
Same causal event storage order
at different locations
Different total event storage order
at different locations
130. Specification
“A comprehensive study of
Convergent and Commutative
Replicated Data Types”
http://hal.upmc.fr/docs/00/55/55/88/
PDF/techreport.pdf
131. Akka CvRDTs
10 implemented from specification
(incl. counters, registers, sets, maps)
In-memory only (non-durable)
Custom data types can be defined
132. Eventuate CmRDTs
4 implemented from specification
(Counter, MV/LWW-register, OR-Set)
Durable via event sourcing
Eventuate CRDT framework