Slide 1

Slide 1 text

RESILIENCE DESIGN PATTERNS @indu_alagarsamy

Slide 2

Slide 2 text

Photo Credit: Roger Taylor

Slide 3

Slide 3 text

Source: https://www.climbing.com/places/itraitor-horn-i5-8-four-pitches-tahquitz-rock-idyllwild-california/

Slide 4

Slide 4 text

Source: https://www.climbing.com/places/itraitor-horn-i5-8-four-pitches-tahquitz-rock-idyllwild-california/

Slide 5

Slide 5 text

DESIGNING FOR SAFETY @indu_alagarsamy LESSONS FROM ROCK CLIMBING

Slide 6

Slide 6 text

SOLID REDUNDANT EQUALIZED NO EXTENSION @indu_alagarsamy

Slide 7

Slide 7 text

SOLID @indu_alagarsamy

Slide 8

Slide 8 text

REDUNDANT @indu_alagarsamy

Slide 9

Slide 9 text

EQUALIZED @indu_alagarsamy

Slide 10

Slide 10 text

NO EXTENSION @indu_alagarsamy

Slide 11

Slide 11 text

DESIGNING FOR RESILIENCE @indu_alagarsamy LESSONS FROM ELECTRICAL ENGINEERING

Slide 12

Slide 12 text

Source: https://www.kayserelectricals.com

Slide 13

Slide 13 text

CIRCUIT BREAKER PATTERN

Slide 14

Slide 14 text

class CircuitBreaker Properties: - string: name of the operation - int: MaxTimesToRetry - TimeSpan: DelayBetweenRetries - Action: Action to invoke when the circuit breaker is tripped Methods: - Reset() - Trip (Exception Ex) @indu_alagarsamy

Slide 15

Slide 15 text

var circuitBreaker = new CircuitBreaker( "CheckServiceConnection", 3, Timespan.FromSeconds(1), action => { WriteLine("Circuit breaker tripped - failfast"); FailFast(connectionException.Message); }); @indu_alagarsamy

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

DESIGNING FOR RESILIENCE @indu_alagarsamy LESSONS FROM THE REAL WORLD

Slide 19

Slide 19 text

Cashier Barista MakeTheDrink(drinkSpecs); drink object ProcessCharge(); return drink; OrderDrink(); Temporal Coupling

Slide 20

Slide 20 text

DrinkOrdered CustomerDrinkPrepared Cashier Barista OrderDrink Publish - Subscribe

Slide 21

Slide 21 text

DESIGNING FOR RESILIENCE @indu_alagarsamy LESSONS FROM CONTROL SYSTEMS ENGINEERING

Slide 22

Slide 22 text

Source: Gareth James, https://flickr.com/photos/ gareth_james_fi/ https://creativecommons.org/licenses/by-nc/2.0/

Slide 23

Slide 23 text

Source:corgi-homeplan-how-safe-is-your-home.org/

Slide 24

Slide 24 text

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

Slide 25

Slide 25 text

REFACTORING TOWARD DEEPER INSIGHT @indu_alagarsamy

Slide 26

Slide 26 text

Source: https://www.apnews.com/73404d09773740f699d4b92933abec50

Slide 27

Slide 27 text

https://www.nytimes.com/interactive/2019/07/16/world/europe/notre-dame.html FEU ATTIC NAVE SACRISTY ZDA-110-3-15-1 ASPIRATING FRAMEWORK @indu_alagarsamy

Slide 28

Slide 28 text

NO FIREWALLS NO SPRINKLERS STONE CEILING WINDING STAIRS Source: https://www.nytimes.com/interactive/2019/04/17/world/ europe/notre-dame-cathedral-fire-spread.html RISKS @indu_alagarsamy

Slide 29

Slide 29 text

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

Slide 30

Slide 30 text

https://indu.dev RESOURCES https://particular.net/blog/protect-your-software-with- the-circuit-breaker-design-pattern https://www.infoq.com/presentations/controllers-observing-systems/ @indu_alagarsamy THANK YOU Domain-Driven Design - Tackling Complexity in the Heart of Software by Eric Evans https://www.infoq.com/presentations/pid-loops/