System Reliability and Resilience and stuff. Some things need to be cleared up first.
-
Upload
hannah-mosley -
Category
Documents
-
view
227 -
download
0
Transcript of System Reliability and Resilience and stuff. Some things need to be cleared up first.
![Page 1: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/1.jpg)
SystemReliability and
Resilienceand stuff
![Page 2: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/2.jpg)
Some things need to be cleared up first
![Page 3: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/3.jpg)
http://en.wikipedia.org/wiki/Vedette_(cabaret)
![Page 4: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/4.jpg)
tuple
![Page 5: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/5.jpg)
//Initialize customer and invoiceInitialize(customer, invoice);
![Page 6: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/6.jpg)
public void Initialize(Customer customer, Invoice
invoice){
customer.Name = “asdf”;invoice.Date = DateTime.Now;
}
![Page 7: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/7.jpg)
Initialize(customer, invoice);//did something happen to customer// and/or invoice?
![Page 8: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/8.jpg)
customer.Name =
InitNameFrom(customer, invoice);invoice.Date =
InitDateFrom(customer, invoice);
![Page 9: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/9.jpg)
customer.Name =
GetNameFrom(customer, invoice);invoice.Date =
GetDateFrom(customer, invoice);
![Page 10: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/10.jpg)
var results = Initialize(customer,
invoice);
customer.Name = results.Item1;invoice.Date = results.Item2;
![Page 11: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/11.jpg)
public tuple<string, DateTime>Initialize(customer,
invoice){
return new Tuple<string, DateTime>
(“asdf”, DateTime.Now);}
![Page 12: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/12.jpg)
public static bool TryParse(string s, out DateTime result)
or
public static tuple<bool, DateTime?>
TryParse(string s)
![Page 13: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/13.jpg)
tuple• Avoid side effects• Avoid out parameters•multiple values without a specific type
![Page 14: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/14.jpg)
null object
![Page 15: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/15.jpg)
private ILogger _logger;public MyClass(ILogger logger) {
_logger = logger;}
…
if (_logger != null) {_logger.Debug(
“it worked on my machine!”);}
![Page 16: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/16.jpg)
null checks for everyone!
![Page 17: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/17.jpg)
forget one and…
![Page 18: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/18.jpg)
public class NullLogger : ILogger {
public void Debug(string text) {
//do sweet nothing}
}
![Page 19: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/19.jpg)
private ILogger _logger = new NullLogger();
public MyClass(ILogger logger) {_logger = logger;
}
…
_logger.Debug(“it worked on my machine!”);
![Page 20: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/20.jpg)
null object• Can eliminate null checks• Simple to implement
![Page 21: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/21.jpg)
Circuit Breaker
![Page 22: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/22.jpg)
![Page 23: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/23.jpg)
Retry
![Page 24: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/24.jpg)
Your
App
licat
ion Out of Process
Dependency
N times
![Page 25: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/25.jpg)
Out of Process Dependency
N times*
Y clients
![Page 26: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/26.jpg)
= Denial of
Service Attack
![Page 27: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/27.jpg)
Limit the # of retries
![Page 28: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/28.jpg)
N * Ybecomes5 * Y
![Page 29: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/29.jpg)
Y isstill a
problem
![Page 30: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/30.jpg)
![Page 31: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/31.jpg)
Circuit Breaker
![Page 32: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/32.jpg)
![Page 33: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/33.jpg)
State Machine
On :: Off
![Page 34: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/34.jpg)
On Offwhen not healthy
![Page 35: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/35.jpg)
Off Onmanually
![Page 36: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/36.jpg)
Get to softwarebefore we ask you to dance
![Page 37: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/37.jpg)
Healthyor
Unhealthy
Out of Process Dependency
![Page 38: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/38.jpg)
State is independent of requestor
Out of Process Dependency
![Page 39: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/39.jpg)
Your
App
licat
ion Has many
independent external dependencies
![Page 40: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/40.jpg)
Your
App
licat
ion
Can throttle itself
![Page 41: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/41.jpg)
Your
App
licat
ion
Has a wait threshold
![Page 42: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/42.jpg)
Your Application
External Dependency
Circuit Breaker
Threshold = 2Pause = 10msTimeout = 30sState = ClosedRequest
Request
Failure (i.e. HTTP 500)Failure Count = 1Pause 10ms
Request
Failure (i.e. HTTP 500)Failure Count = 2State = Open
OperationFailedException
![Page 43: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/43.jpg)
Threshold = 2Pause = 10msTimeout = 30sState = OpenRequest
30s has not passed
CircuitBreakerOpenException
Request
30s has not passed
CircuitBreakerOpenException
System can try to
become healthyfor 30s
Your Application
External Dependency
Circuit Breaker
![Page 44: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/44.jpg)
Threshold = 2Pause = 10msTimeout = 30sState = ½ OpenRequest
Request
Failure (i.e. HTTP 500)Failure Count = 2State = Open
OperationFailedException
30s has passed
Your Application
External Dependency
Circuit Breaker
![Page 45: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/45.jpg)
Threshold = 2Pause = 10msTimeout = 30sState = ½ OpenRequest
Request
Failure Count = 0State = Closed
Response
30s has passed
Response
Your Application
External Dependency
Circuit Breaker
![Page 46: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/46.jpg)
ClosedOpen
½ Open
![Page 47: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/47.jpg)
½ Open is like a
manual reset
![Page 48: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/48.jpg)
PauseTimeout
![Page 49: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/49.jpg)
Pausebetween calls
in the loop
![Page 50: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/50.jpg)
Timeoutbefore you
can call again
![Page 51: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/51.jpg)
Exceptions
![Page 52: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/52.jpg)
OperationFailed:
AggregateException
![Page 53: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/53.jpg)
CircuitBreakerOpen:
ApplicationException
![Page 54: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/54.jpg)
Don’t Loose Exception Info
![Page 55: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/55.jpg)
Always use InnerException(s)
![Page 56: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/56.jpg)
Threshold = 3State = ClosedRequest
Request
Failure (i.e. HTTP 500)Request
Failure (i.e. HTTP 500)Failure Count = 2
Failure Count = 0State = Closed
Response
Response
Request?Your
ApplicationExternal
DependencyCircuit
Breaker
Failure Count = 1
![Page 57: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/57.jpg)
SegregateDependencies
![Page 58: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/58.jpg)
circuitBreaker(“database”)
circuitBreaker(“weatherservice”)
![Page 59: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/59.jpg)
Dependency type, endpoint svc,
endpoint
![Page 60: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/60.jpg)
Where?
![Page 61: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/61.jpg)
Your
App
licat
ion Out of Process
DependencyCi
rcui
t Bre
aker
Prox
y
![Page 62: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/62.jpg)
Watch forInception
![Page 63: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/63.jpg)
Your
App
licat
ion W
eb ServiceCi
rcui
t Bre
aker
Circ
uit B
reak
er
Prox
y
DatabaseRepo
sitor
y
![Page 64: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/64.jpg)
circuit breaker• retry looping• slow down attempts• good neighbour
![Page 65: System Reliability and Resilience and stuff. Some things need to be cleared up first.](https://reader033.fdocuments.in/reader033/viewer/2022052300/5a4d1af47f8b9ab0599806f1/html5/thumbnails/65.jpg)
¡Muchas gracias!