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

Control the Chaos - testing akka-based applications against persistence failures

Control the Chaos - testing akka-based applications against persistence failures

Akka doesn't guarantee message delivery, especially for remoting or persistent actors.

During this talk, you will learn how a very simple idea of how to test with minimal effort if your Akka application is resilient in case of persistence failures. Chaos testing is very broad and complex topic. If you would like to test your application against one specific point of failure, it may be too expensive to use standard chaos testing techniques. In case of persistence failures you will discover how to use "ChaosJournal" - journal that randomly fails.

You will explore a simple case study, practical advices, ideas and pitfalls. The talk will be about testing, not how to prevent loosing messages itself. Similar techniques may be used for testing against eg. remoting failures.

Piotr Śliwa

February 08, 2018
Tweet

Other Decks in Programming

Transcript

  1. The story 4. Introduce AtLeastOnceDelivery http message AtLeastOnce Delivery The

    business logic https://pixabay.com/en/email-letter-send-envelope-mail-297632/
  2. The story 4. Introduce AtLeastOnceDelivery http message AtLeastOnce Delivery The

    business logic HTTP 200 https://pixabay.com/en/tick-mark-ok-perfect-check-done-305245/
  3. Testing: Chaos Journal Simulate random persistence failures during E2E tests


    https://pixabay.com/en/swatter-insecticide-fly-insect-147936/ https://pixabay.com/en/animal-fly-insect-1295030/
  4. Chaos Journal Basic Chaos Journal implementation used in Akka Persistence

    tests 
 then Wrapper for akka-persistence-inmemory plugin
  5. Chaos Journal Basic Chaos Journal implementation used in Akka Persistence

    tests
 then Wrapper for akka-persistence-inmemory plugin
 1. Random persistence failures (reads, writes) 2. Random persistence latency (writes) 3. Persistence Query support
  6. Tests preparation Problem 1: the application sometimes responded 500 error

    in tests Solution: retry policy in E2E test for http messages
  7. Tests preparation Problem 2: some messages were allowed to be

    lost because eg. they were sent periodically
  8. Tests preparation Problem 2: some messages were allowed to be

    lost because eg. they were sent periodically Solution: repeat such messages periodically while asserting the result
  9. Tests preparation Problem 3: unstable tests because circuit breakers open,

    backoff supervisors work too slow... Solution: tune backoff supervisors, retries interval, circuit breakers etc. in order to make test stable
  10. Tests preparation Problem 4: Chaos Journal tests were few times

    slower than naked tests Solution: run tests in parallel in the pipeline
  11. Tests preparation Problem 5: Tests were not deterministic, even if

    there was a bug - they could pass Solution: run them hundred times during night build
  12. The epilogue 7. A lot bugs discovered and fixed with

    low cost, more confidence to application resiliency https://pixabay.com/en/green-forest-beech-trees-wood-2830942/
  13. Thanks! Q&A? Links: • https://goo.gl/BnC39D - ChaosJournal from Akka Persistence

    test sources • https://github.com/psliwa/akka-persistence-chaos-journal Piotr Śliwa 
 @ psliwa