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

Resilience Design Patterns

Resilience Design Patterns

How does your system react if a key resource fails? The database becomes unavailable or the message broker fails? What if you get a current surge of load that you have to keep up? Real life and other engineering disciplines can teach us a thing or two on software design and what it means to be reliable.

Learn useful techniques and patterns that you can borrow from other areas of engineering and see how to apply them in your systems to make it more reliable.

Indu Alagarsamy

October 17, 2019
Tweet

More Decks by Indu Alagarsamy

Other Decks in Programming

Transcript

  1. class CircuitBreaker Properties: - string: name of the operation -

    int: MaxTimesToRetry - TimeSpan: DelayBetweenRetries - Action<Exception>: Action to invoke when the circuit breaker is tripped Methods: - Reset() - Trip (Exception Ex) @indu_alagarsamy
  2. var circuitBreaker = new CircuitBreaker( "CheckServiceConnection", 3, Timespan.FromSeconds(1), action =>

    { WriteLine("Circuit breaker tripped - failfast"); FailFast(connectionException.Message); }); @indu_alagarsamy
  3. public void When_the_circuit_breaker_is_tripped_the_trip_action_ is_called_after_reaching_max_threshold() { var connectionException = new Exception("Something

    bad happened."); circuitBreaker.Trip(connectionException); System.Threading.Thread.Sleep(5000); Assert.IsTrue(circuitBreakerTripActionCalled); } @indu_alagarsamy
  4. public void When_the_circuit_breaker_is_reset_the_trip_action_is _not_called() { var connectionException = new Exception("Something

    bad happened."); circuitBreaker.Trip(connectionException); System.Threading.Thread.Sleep(1000); circuitBreaker.Reset(); Assert.False(circuitBreakerTripActionCalled); } @indu_alagarsamy
  5. PROCESS VARIABLE SET POINT @indu_alagarsamy Desired value for the variable,

    eg. 25 Celsius Current measured value of a process that is being monitored or controlled. E.g. 23 Celsius ERROR VALUE Difference between the Set Point and the Process Variable
  6. WHEN YOU EXPECT MIRACLES FROM THE SYSTEM, YOU’RE IN FOR

    A BROKEN HEART - JOHN LONG Picture Source: https://www.piquenewsmagazine.com/whistler/the-life- advice-john-long-gave-me-before-he-forgot-my-name/Content? oid=7931226 @indu_alagarsamy