2024: Domino Containers - The Next Step. News from the Domino Container commu...
Going Resilient...
1. BASEL BERN BRUGG DÜSSELDORF FRANKFURT A.M. FREIBURG I.BR. GENF
HAMBURG KOPENHAGEN LAUSANNE MÜNCHEN STUTTGART WIEN ZÜRICH
Going Resilient...
Building blocks of failure-tolerant systems
Anatole Tresch, Principal Consultant
5. Going Resilient…5 19.10.16
“But it ain't how hard you hit; it's
about how hard you can get hit,
and keep moving forward. How
much you can take, and keep
moving forward. That's how
winning is done. “
Rocky Balboa
https://www.youtube.com/watch?v=vJHkTtvnUqA
Resilience/Resiliency is ...
46. Almost every system is a
distributed system.
Going Resilient…46 6.09.16
complex
Chas Emerick
47. Complex systems...
Going Resilient…47 19.10.16
«We can model and understand in isolation. But, when released into
competitive nominally regulated societies, their connections
proliferate, their interactions and interdependencies multiply, their
complexities mushroom. And we are caught short.»
Sidney Dekker
48. Do not try to avoid failures.
Embrace them!
Going Resilient…48 6.09.16
55. A command is a task is a ...
Going Resilient…55 19.10.16
Command
Input
Output
Error
56. Commands can be connected...
Going Resilient…56 19.10.16
Command
Input
Output | Input
Error
Output
Error
Command
57. Command
So where „resilience“
must be added?
Going Resilient…57 19.10.16
Command
Input
Command
Command
●
Isolation
●
Decouple communications
with events
●
Flow Control
Manage state
62. Latency Control
Going Resilient…62 19.10.16
●
Bounded Queues
●
Fan out & quickest reply
●
Circuit Breakers and Fail Fast
●
Timeouts
●
Throttling, Semaphores
●
Failover
●
Degration of service level
63. Managing shared state: Quorums
Going Resilient…63 19.10.16
Ensure decision can be taken at any time
Even number of voters, num >= 3
64. Kernel Based Architecture
Going Resilient…64 19.10.16
Structure systems like onions in layers:
• State & failure
management in layers
• „Kernel“ holds and protects the
critical state
• Kernel is engaged always
through layers of protection
65. Rounding up...
Going Resilient…65 19.10.16
Resilient Systems in IT require
Asynchronous Communications
Idempotent, self-containing events
Location Transparency
Isolation & Recursive Restartability
Complete, unified Input and Output Validation
Common Error Handling and Monitoring
Supervision
Minimal shared state, Redundancy
71. Going Resilient…71 19.10.16
public void myMethod(Input input){
Future<String> resultFuture =
executor.submit(()->{service.call(input);});
try{
String result = resultFuture.get(4000L,
TimeUnit.MILLISECONDS);
// do something with the result
}catch(Exception e){
throw new IllegalStateException(„Server error“, e);
}
}
Executor Example, using a timeout
80. Going Resilient…80 19.10.16
Spring Boot with Hystrix – CircuitBreaker
@SpringBootApplication
@EnableCircuitBreaker
public class Application {
public static void main(String[] args) {
new SpringApplicationBuilder(Application.class)
.web(true).run(args);
}
}
@Component
public class StoreIntegration {
@HystrixCommand(fallbackMethod = "defaultStores")
public Object getStores(Map<String, Object> parameters) {
//do stuff that might fail
}
public Object defaultStores(M
return "something useful";
}
}
82. Going Resilient…82 19.10.16
Akka – A simple Agent
public class HelloWorld extends UntypedActor {
@Override
public void preStart() {
final ActorRef greeter = getContext().actorOf(
Props.create(Greeter.class), "greeter");
greeter.tell(Greeter.Msg.GREET, getSelf());
}
@Override
public void onReceive(Object msg) {
if (msg == Greeter.Msg.DONE) {
// when the greeter is done, stop this actor and with it the application
getContext().stop(getSelf());
} else {
unhandled(msg);
}
}
}
88. Summmary
Going Resilient…88 19.10.16
Resilience Software Design
...is a must!
...is achievable
...is well supported by frameworks such as Hystrix and Akka
The patterns used used are ubiquious for all kind of distributed
systems
...fits naturally with microservices
90. Going Resilient…90 19.10.16
Going Resilient...
• Hystrix Wiki,https://github.com/Netflix/Hystrix/wiki
• Jonas Boner: Resilience is by design: http://virtualjug.com/resilience-is-by-design/
• R.Cook, J. Rasmussen: “Going solid”: a model of system dynamics and consequences for patient safety
• Reinette Biggs et al.: Applying Resilient Thinking: Toward Resilient Architectures
• Michael Mehaffy, Nikos A. Salingaros : 1 - Biology Lessons:
• Richard Cook : How complex systems fail
• http://www.mindsetonline.com/
• George Candea, Amando Fox : Crash Only Software
• George Candea, Amando Fox : Turning the Crash-Only Pattern from a Slash-Hammer to a Scalpell
• Michael T. Nygard, Release It!,Pragmatic Bookshelf, 2007
• Robert S. Hanmer, Patterns for Fault Tolerant Software, Wiley, 2007
• Andrew Tanenbaum, Marten van Steen, Distributed Systems – Principles and Paradigms, Prentice Hall, 2nd Edition, 2006
• Uwe Friedrichsen, Slideshare: http://de.slideshare.net/ufried