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
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
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/