Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
E-VAN - Sagas
1. What’s this “Saga” thing
that everyone is talking
about?
@andreasohlund
http://andreasohlund.net
2. What is a long running
process?
“A long running process is a process whose
execution lifetime exceeds the time to
process a single external event or message”
- Udi Dahan
5. The problem
• Holding locks for the duration of a long
running transaction are more likely
• To be deadlocked
• To experience infrastructure failures
21. Existing sagas
Get
Message
Saga
Bus Persister
Load/Store
DB
22. Existing sagas
Get
Message State
Saga Saga
Bus instance Persister
Load/Store
DB
23. Existing sagas
Get
Message State
Dispatch
Saga Saga
Bus instance Persister
Load/Store
DB
24. Existing sagas
Get
Message State
Dispatch
Saga Saga
Bus instance Persister
Send
Load/Store
DB
25. Existing sagas
Get
Message State
Dispatch
Saga Saga
Bus instance Persister
Send
Save
Load/Store
DB
26. State
• Remember what steps have been executed
• Gets persisted between each step
• Temporary storage of data
• Serialize access to the same saga instance
• Unique index
• Locking
27. Time
• Long running transactions
• Time is a business requirement
• Needs to be durable and managed externally
Notas do Editor
LLT - Long lived transactions - Hector Garcia-Molina 87 Top level is a business transaction Does not comply to ACID Requires compensating actionsSecond level is acid compliantAnalyze the business to find the boundaries Add messages -> in order to make each step as short as possible + forward movement only
Developers tends to do the same mistakes today
Top level is a business transaction Does not comply to ACID Requires compensating actionsSecond level is acid compliantAnalyze the business to find the boundaries Add messages -> in order to make each step as short as possible + forward movement only
One way messaging only to keep transaction as short as possible More scalable and robust http://www.udidahan.com/2008/06/23/sagas-solve-stupid-transaction-timeouts/ Can execute “steps” in parallelSaga instances are not run in parallelUse locks in DB to ensure that
Not a hard rule Sagas are useful for other non DDD related things
Sagas operate within a BC Can react to events from other BC’s