7 When bad things happen: Resiliency patterns with Spring Cloud and Netflix Hystrix

 

This chapter covers

  • Implementing circuit breakers, fallbacks and bulkheads
  • Using the circuit breaker pattern to conserve microservice client resources
  • Using Hystrix when a remote service is failing
  • Implementing Hystrix’s bulkhead pattern to segregate remote resource calls
  • Tuning Hystrix’s circuit breaker and bulkhead implementations
  • Customizing Hystrix’s concurrency strategy

All systems, mainly distributed systems, will experience failure. How we build our applications to respond to that failure is a critical part of every software developer’s job. However, when it comes to building resilient systems, most software engineers only take into account the complete failure of a piece of infrastructure or critical service. They focus on building redundancy into each layer of their application using techniques such as clustering key servers, load balancing between services, and segregation of infrastructure into multiple locations.

While these approaches take into account the complete (and often spectacular) loss of a system component, they address only one small part of building resilient systems. When a service crashes, it’s easy to detect that it’s no longer there, and the application can route around it. However, when a service is running slow, detecting that poor performance and routing around it is extremely difficult because

7.1           What are client-side resiliency patterns?

 

7.1.1   Client-side load balancing

 
 
 

7.1.2   Circuit Breaker

 

7.1.3   Fallback processing

 
 

7.1.4   Bulkheads

 
 

7.2           Why client resiliency matters?

 
 
 
 

7.3           Implementing Hystrix

 

7.4           Setting up the licensing server to use Spring Cloud and Hystrix

 
 

7.5           Implementing a circuit breaker using Hystrix

 
 

7.5.1   Timing out a call to the organization microservice

 
 
 

7.5.2   Customizing the timeout on a circuit breaker

 

7.6           Fallback processing

 

7.7           Implementing the bulkhead pattern

 

7.8           Getting beyond the basics; fine-tuning Hystrix

 
 
 
 

7.8.1   Externalize Hystrix Parameters

 
 
 
 

7.8.2   Hystrix configuration revisited

 

7.9           Thread context and Hystrix

 
 

7.9.1   ThreadLocal and Hystrix

 
 
 
 

7.9.2   The HystrixConcurrencyStrategy in action

 
 

7.10       Summary

 
 
 
 
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest