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

The Shocking Truth About Circuit Breakers

The Shocking Truth About Circuit Breakers

Circuit Breakers: we know them & love them, right? Honestly, I'm not sure. For those of us lucky enough to have used them, we understand why we need them. But do we fully understand how they work? What problem are they actually trying to solve? Can we communicate this to our organization in way that they can jump on board? What happens when they go off? Shocking plot twist: I love Circuit Breakers. They are a secret sauce to solving the murder mystery that is your microservices architecture.

The Demo Project can be found at https://github.com/anfleene/circuit_breaker_demo

Andy Fleener

May 18, 2017
Tweet

More Decks by Andy Fleener

Other Decks in Technology

Transcript

  1. @andyfleener Cue Martin Fowler wrap a protected function call in

    a circuit breaker object Monitors for failures Failures reach a certain threshold, the circuit breaker trips Calls to the circuit breaker return with an error, without the protected call being made at all Eventually a timer expires and attempts the call again If success go back to 1 If failure go back to 3
  2. @andyfleener 1. I should wrap every network call in a

    Circuit Breaker I’m going to start that tomorrow!
  3. @andyfleener Complex Systems Cliff Notes They are unsafe They will

    always be unsafe Failure is inevitable Embrace the failure
  4. Ok awesome, lets fail on purpose! Now What? Prioritize based

    on impact by identifying central services that would amplify a cascade Circuits are only effective at the service level picking and choosing still leads to #cryparty Use an abstraction, make the right thing easy. You shouldn’t have to reinvent the wheel on every api call
  5. Finding a Library: Someone has implemented this pattern in any

    language used for the web They may or may not be using it in production Test. Test. Test. Timeouts are a primitive of a Circuit Breaker they must be built into it.