Cloud-Native Integration Microservices with Netflix’ Hystrix Circuit Breaker and TIBCO BWCE
Blog: The Tibco Blog
Cloud-native microservices offer many benefits. You can develop, test, and deploy and maintain independent lightweight services. You can easily combine various technologies, including programming languages such as Java or Go, and tools like integration middleware. However, as you do not build monoliths anymore, ”that complexity has moved and […] increased [to] the outer architecture” as Gartner states. For these reasons, new design patterns (have to) emerge to solve the challenges of independent, distributed microservices.
Circuit Breaker design pattern for resilient microservice architectures
The Circuit Breaker is one of these design patterns. It allows:
- Fail fast and rapidly recover
- Prevent cascading failures
- Latency tolerance logic
- Fault tolerance logic
- Fallback options
This is realized by rejecting service requests if a service is not available for whatever reason; in a microservice architecture there can be many reasons or issues. The rejection is configured by various parameters such as request volume threshold or error threshold percentage.
Martin Fowler has a great explanation of the Circuit Breaker design pattern. Therefore, I will just explain it briefly using one of his graphics:
The circuit is closed in the beginning. All service requests get a successful response from the service. If a threshold of 5 failures is reached, the circuit is opened. New service requests are rejected. After a timeout of 1 minute, a new service request tries if the service is available again; therefore the circuit i.e. half open in this state. Depending on the success or failure, the circuit is opened or closed after this service request.
This relative simple pattern can get very powerful (depending on the configuration options) and allows to build resilient microservice architectures with reduced latency and lowered resource consumption.
Netflix’ open source implementation ‘Hystrix’
Hystrix was open source-d by Netflix a few years ago and is by far the most widely used framework for using the Circuit Breaker pattern in a microservices architecture.
Microservice architectures and cloud-native platforms such as Cloud Foundry or Kubernetes can leverage Hystrix to build resilient microservice deployments. In addition, you can leverage the Hystrix Dashboard to get some near real time visualization. The video Hystrix Dashboard—Tech Talk and Demo shows a great introduction. Here is a screenshot explaining the key aspects of the dashboard:
The dashboard does its job. But, in more sophisticated microservice architectures, you might leverage the benefits of a real time streaming analytics visualization tool like TIBCO Live Datamart. This allows not only monitoring of live streaming data, but also applies rules and predictive analytics for automated or human-driven decision-making.
TIBCO BWCE + Netflix’ Hystrix = resilient integration microservices
A resilient architecture is even more important for integration services because they interconnect everything. If the integration service is not resilient, fails all the time, or becomes unresponsive, the complete enterprise gets into trouble. Therefore, circuit breakers can help a lot to make integration services more resilient. The following demo setup includes several cloud native components:
With focus on Circuit Breakers, we use TIBCO BusinessWorks Container Edition (BWCE), Docker, and Netflix’ Hystrix. The same could be achieved on other cloud-native platforms like Kubernetes or CloudFoundry in the same way. BWCE offers out-of-the-box support for circuit breakers. You just enable it and configure the required parameters:
Details about the configuration and options can be found in the BWCE documentation.
Live video: Development, deployment, and monitoring with TIBCO BWCE and Hystrix Dashboard
The following video demos how to use BWCE with Netflix’ Hystrix open source implementation of the design pattern ‘Circuit Breaker’ to develop, deploy, and monitor cloud native middleware microservices.
Find more information about cloud native middleware in the TIBCO Community: Microservices, Containers, and Cloud Native Architectures. Please use the BusinessWorks Community Q&A to ask questions and discuss concepts or use cases for BWCE and design patterns like Circuit Breaker.