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

Resiliente Microservices mit Spring Boot und Failsafe

Malte
March 16, 2018

Resiliente Microservices mit Spring Boot und Failsafe

Beim Entwickeln einer Microservice-Architektur ist man mit Herausforderungen verschiedenster Natur konfrontiert. Zwei dieser Herausforderungen sind das Entwickeln robuster und resilienter Systeme. Dies ist besonders wichtig, wenn die Services in einer Umgebung betrieben werden, in der sich außerordentliche Lastspitzen ergeben. Es muss gewährleistet werden, dass die Systeme robust genug sind, um diesen Spitzen standzuhalten und weiterhin verfügbar sind, obwohl Fremdsysteme ausfallen.

Der Vortrag geht darauf ein, wie diese Eigenschaften mit Hilfe der Bibliotheken Spring Boot und Failsafe bei Zalando Payments implementiert wurden. Darüber hinaus wird gezeigt, wie die Bibliothek Failsafe-Actuator beim Überwachen im produktiven Betrieb unterstützt.

Malte

March 16, 2018
Tweet

Other Decks in Programming

Transcript

  1. 2 ZALANDO TECHNOLOGY HOME-BREWED, CUTTING-EDGE & SCALABLE technology solutions 1,800

    employees from tech locations + HQs in Berlin 6 77 nations help our brand to WIN ONLINE
  2. 4 RESILIENCE In computer networking: resilience is the ability to

    provide and maintain an acceptable level of service in the face of faults and challenges to normal operation. [0]
  3. 5 MICROSERVICES Accept failures instead of avoiding them • Latency

    • Network • More clients • Maybe even unknown clients
  4. 6 SPRING BOOT Takes an opinionated view of building production-ready

    Spring applications. Spring Boot favors convention over configuration and is designed to get you up and running as quickly as possible. [1]
  5. 7 ACTUATOR Actuator endpoints allow you to monitor and interact

    with your application. Spring Boot includes a number of built-in endpoints and you can also add your own. For example the health endpoint provides basic application health information. [2]
  6. 8 FAILSAFE Failsafe is a lightweight, zero-dependency library for handling

    failures. It was designed to be as easy to use as possible, with a concise API for handling everyday use cases and the flexibility to handle everything else. [3]
  7. 9 FAILSAFE Calls can be put to Lambda expressions or

    Callbacks Execution Context Supports retries out of the box Async execution can be observed via Listener API
  8. 11 CIRCUIT BREAKER • Fail fast • Be excellent to

    others • Three states ◦ Closed ◦ Open ◦ Half Open
  9. 14 FALLBACK • Call alternative service in case primary is

    unavailable • Not only be available, but also deliver valid results
  10. 15 • Product detail page • Customer might not be

    interested in details at all • Why should we serve a 500 because of that and miss the sale? REAL WORLD EXAMPLE
  11. 17 RETRY • Retry call in case of transient errors

    • Try to get as much through at possible • Every request is a paying customer
  12. 19 RETRY delay = backoff + jitterFactor • backoff is

    growing exponentially with each retry (1 .. 5 seconds) • jitterFactor is randomly picked in range (-10 .. 10 ms) • retries will be equally distributed
  13. 20 • Monitor Circuit Breaker to identify problems early •

    Returns JSON containing the state of all registered Circuit Breaker • Failsafe-Actuator provides this functionality ◦ Spring Boot 2 support close to come MONITORING