Applying the Saga Pattern • Caitie McCaffrey • GOTO 2015
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about cross-service or cross-database transactions, microservices consistency, and Saga or process-manager designs, including in Redux Saga contexts.
Recommended by 3 people across 6 different months, 2015 to 2018.
What it is
A GOTO Chicago 2015 conference talk by Caitie McCaffrey, then at Twitter, on using the Saga pattern to coordinate long-running, multi-step work across services when traditional ACID transactions with two-phase commit no longer fit. It covers how sagas break a transaction into compensable steps and how to apply them in distributed systems.
What people said
Recommends Sebastien Lorber · 2015-11 · Stack Overflow · on “Should I use one or several action types to represent this async action?”
I agree with Dan Abramov: if the text and categories are highly coupled in your interface, just fire FETCH_RESULTS with the text and categories as action payload. If the text input and categories selection widget do not share a close parent component, it is complicated to fire a FETCH_RESULTS which contains the text and categories (unless passing a lot of props down the tree...): you then need the action granularity. One pattern that I have found helpful when such granularity is needed is the Saga [this video] / Process manager pattern. I've written a bit about it here: [LINK] Basically, implementing this on redux would mean there's a very special kind of reducer that can trigger side-effects. Th
Recommends rystsov · 2016-03 · Stack Overflow · on “RethinkDB Transaction to multiple documents/tables”
RethinkDB supports per key linearizability and compare-and-set (document level atomicity) and it's known to be enough to implement application level transactions, more over you have several options to choose from: If you need Serializable isolation level then you can follow the same algorithm which Google use for the Percolator [LINK] system or Cockroach Labs for CockroachDB [LINK] . I've blogged about it and create a step-by-step visualization [LINK] , I hope it will help you to understand the main idea behind the algorithm. If you expect high contention but it's fine for you to have Read Committed isolation level then please take a look on the RAMP transactions [LINK] by Peter Bailis. The
Recommends rystsov · 2016-03 · Stack Overflow · on “Is there any NoSQL data store that is ACID compliant?”
A lot of modern NoSQL solution don't support ACID transactions (atomic isolated multi-key updates), but most of them support primitives which allow you to implement transactions on the application level. If a data store supports per key linearizability and compare-and-set (document level atomicity) then it's enough to implement client-side transactions, more over you have several options to choose from: If you need Serializable isolation level then you can follow the same algorithm which Google use for the Percolator [LINK] system or Cockroach Labs for CockroachDB [LINK] . I've blogged about it and create a step-by-step visualization [LINK] , I hope it will help you to understand the main id
Recommends rystsov · 2016-03 · Stack Overflow · on “Storing transactions into a NoSQL Database”
Using polyglot persistence increases the operation load, so if it's possible to solve the task with one data store then it's better not to introduce additional entities. In your case it seems that you want to have auditable transaction history, consistent current balance and you don't want to abandon the transaction guarantees. It's true that almost all modern NoSQL solution don't support ACID transactions out of the box, but most of them support primitives which allow you to implement transactions on the application level. If a data store supports per key linearizability and compare-and-set (document level atomicity) then it's enough to implement client-side transactions, more over you have
Recommends rystsov · 2016-04 · Stack Overflow · on “How to manage transactions over multiple databases”
Both Cassandra & PostgreSQL support linearizability and compare-and-set (CAS), so you can implement transactions on the client side. If you want Serializable Isolation level then you should take a look on the Percolator's transactions [LINK] . The Percolator's transactions are quite known in the industry and have been used in the Amazon's DynamoDB transaction library [LINK] , in the CockroachDB database [LINK] and in the Google's Pecolator system itself. A step-by-step visualization [LINK] of the Percolator's transactions may help you to understand it. If you expect contention and can deal with Read Committed isolation level then RAMP transactions [LINK] by Peter Bailis may suit you. I also
Recommends rystsov · 2016-08 · Stack Overflow · on “Providing transaction support in Cassandra”
Cassandra supports per-key linearizability and compare-and-set (CAS). It's enough for implementing transactions on the client side. Percolator's transactions [LINK] provides serializable isolation level. They are quite known in the industry and are in use in the Amazon's DynamoDB transaction library [LINK] , in the CockroachDB database [LINK] and in the Google's Pecolator system itself. A step-by-step visualization [LINK] of the Percolator's transactions may help you to understand them. If you expect contention and can deal with Read Committed isolation level then RAMP transactions [LINK] by Peter Bailis may suit you. I also created a step-by-step RAMP visualization [LINK] which may be usefu
Recommends rystsov · 2017-10 · Stack Overflow · on “How to achieve immediate consistency in microservice architecture?”
There are several techniques which can provide cross-service transactions (atomicity): 2PC, Percolator's transactions and Sagas. Percolator's transactions [LINK] have serializable isolation level. They are known in the industry, see: Amazon's DynamoDB transaction library [LINK] , CockroachDB database [LINK] , and the Google's Pecolator system itself. A step-by-step visualization [LINK] of the Percolator's transactions may help you to understand how they work. The saga pattern was described in the late 80s in the Sagas [LINK] paper but became more relevant with the rise of microservices. Please see the Applying the Saga Pattern [this video] talk for inspiration. But since you mentioned eventual co
Recommends VoiceOfUnreason · 2018-05 · Stack Overflow · on “DDD Modify one aggregate per transaction with invariants in both aggregates”
How can we enforce those invariants using the one aggregate per transaction rule? There are a few different answers. One is to abandon the "rule" - limiting yourself to one aggregate per transaction isn't important. What really matters is that all of the objects in the unit of work [LINK] are stored together, so that the transaction is an all or nothing event. BEGIN TRANSACTION UPDATE ORGANIZATION UPDATE TENANT COMMIT A challenge in this design is that the aggregates no longer describe atomic units of storage - the fact that this organization and this tenant need to be stored in the same shard is implicit, rather than explicit. Another is to redesign your aggregates - boundaries are hard, an
Cites Mulan · 2016-02 · Stack Overflow · on “How to design a state flow for a react/redux flashcard game?”
@DanAbramov So I've done some reading on the Saga Pattern, watched the Applying Saga Pattern video [this video] from the Redux Saga docs, and played around with some of the Redux Saga examples. Before I move forward with attempting to use this, I just want to be clear that my game is a purely local/synchronous game with the possible exception of loading the full deck asynchronously once before the first game, and asynchronously submitting stats after the game ends.
Cites rystsov · 2016-03 · Stack Overflow · on “How do transactions differ in RDBMS and Nosql?”
Usually NoSQL data stores lack the atomic multi key updates and support transaction only on the document level. It means that if you use straightforward approach to transfer money from one account to another you may end up with very unexpected results. Here a couple of scenarios what can happen: Withdraw money, got a error in the process of transfer and lost the information about the transaction and hence the money Withdraw the same money twice from an account in case of concurrent withdraw operation (double-spending) Withdraw and successfully deposit money to the target account but lost them because of the concurrent account update (lost update) But you can implement ACID transaction on the