Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Sagas: Distributed Transactions Without Locks

Sagas: Distributed Transactions Without Locks

This talk discusses the sagas pattern and an Erlang implementation of the pattern from Erlang User Conference 2017

Jade Allen

June 08, 2017
Tweet

More Decks by Jade Allen

Other Decks in Technology

Transcript

  1. The Big Idea Fold over a list of closures… ...unless

    there’s an error; Then, fold over a list of closures.
  2. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  3. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  4. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  5. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  6. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  7. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  8. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  9. Flows Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5 BOOM
  10. Terminology Forward 1 Forward 2 Forward 3 Forward 4 Forward

    5 Rollback 1 Rollback 2 Rollback 3 Rollback 4 Rollback 5
  11. What if?? Forward 1 Forward 2 Forward 3 Forward 4

    Rollback 1 Rollback 2 Rollback 3
  12. What is it? §Write one or more invariants §Test values

    are automatically generated and the invariant tested §Failures are shrunk to the smallest possible failure case §Modify code (or test case) and restart test §Tests are usually timeboxed §Extremely useful to build confidence in complex scenarios
  13. Implementations for §Go §C/C++ §Clojure §Scala §Haskell (of course) §…

    lots of others … §Erlang/Elixir (watch Thomas Arts talk at ElixirConf EU 2015)
  14. Erlang implementations §Quviq Commercial QuickCheck (http://www.quviq.com) §Free (but not open

    source) “QuickCheck mini” – doesn’t do statem §PropEr (https://github.com/manopapad/proper) §Triq (https://github.com/triqng/triq)
  15. Generators §All standard basic types: §integers, §floats, §atoms, §binaries, §strings,

    §lists §Lists of basic types §User defined generators using ?LET and ?SUCHTHAT
  16. Resources §https://github.com/mrallen1/gisla §https://github.com/mrallen1/criswell §Sagas paper: http://www.cs.cornell.edu/andru/cs711/2002fa/reading/sagas.pdf §Caitie McCaffrey, Papers We

    Love on Sagas: https://youtu.be/7dc4Tl5ZHRg?t=27m16s §Caitie McCaffrey, Distributed Sagas: https://speakerdeck.com/caitiem20/distributed-sagas-a-protocol-for- coordinating-microservices §These slides: https://speakerdeck.com/mrallen1/sagas-distributed-transactions- without-locks