In this chapter, we will explore the circuit-breaker pattern with a reference implementation using the Netflix Hystrix library, looking at configuring the Turbine dashboard to aggregate Hystrix streams from multiple services. We will also cover some important aspects of the Turbine dashboard to aggregate the data streams from multiple services.
In microsystem architecture, we have seen that a monolithic application is divided into several pieces of software, and each is deployed as an individual service. This system is known as a distributed system. It has a lot of benefits, as we discussed in Chapter 4, Getting Started with Spring Cloud and Configuration. Due to the distributed nature of cloud-native applications, they have more potential failure modes than monolith applications. As the number of services will be increased in distributed systems, it will also increase the chance of cascading failures.
As each incoming request must now potentially touch tens or even hundreds of different microservices, some failure in one or more of those dependencies is virtually guaranteed. Let's see the famous quote regarding fault tolerance:
In this chapter, we will discuss a pattern to prevent the cascading failures of these microservices and avoid negative availability services in the distributed systems.
By the end of this chapter, you will have a better understanding of fault tolerance, and the circuit-breaker pattern, how to use the Netflix Hystrix library to prevent cascading failures in a distributed system, and how to enable Hystrix and Turbine dashboard to monitor the failures.
This chapter will cover the following points:
- Circuit-breaker pattern
- Using the Hystrix library with a reference implementation
- Customizing the default configuration
- Hystrix Metrics Stream
- Hystrix Dashboard
- Turbine dashboard
- REST consumer with Hystrix and Feign
Let's look at these topics in detail.