Hystrix has been pretty popular over the last several years. Now that it is in maintenance mode, many people are seeking alternatives. In this article, I will introduce Sentinel: an open-source Java flow control project. I will do so by comparing it with Hystrix, since more people are familiar with it. In this part, we'll compare these two at a higher level. In the next article, we'll look at some code examples.
In short, it is a circuit breaker. A circuit breaker is triggered when certain resources keep failing. Instead of continuing to pound the already failing resource, the circuit breaker will intercept the request and return a failure signal. That sounds similar to every circuit breaker pattern. However, Sentinel offers more choices such as flow shaping, overload protection, and fault tolerance.
The key difference between the two lies in how isolation is achieved. Hystrix normally uses bulkhead pattern to isolate dependencies. It puts each dependency in a seperate thread pool. The main benefit of doing this is it provides a clean cut. The drawbacks mainly include the computational overhead thread pool management incurs.
Sentinel, on the other hand, uses a counter for each dependency. By doing so, not only does it save the overhead of managing the thread pool, but it also gives more control to the user. The user now gets to decide the granularity of degradation of the flow.
This table lists more details of the difference Hystrix and Sentinel in design and implementation:
This may seem a little overwhelming. Users won't notice much difference from a user experience perspective, though.
Sentinal is well suited for the cloud-native environment. It can be integrated with other popular cloud native solutions. One of them is Spring Cloud. Another popular java distributed framework in China is Dubbo. Sentinal can also work side by side with service mesh solutions such as Istio and Envoy.
Sentinal will soon be released as part of the Spring Boot framework. For more information, please visit their GitHub repo.
Aliware - April 28, 2019
Aliware - May 13, 2019
Alibaba Developer - January 16, 2019
Alibaba System Software - December 6, 2018
Alibaba Clouder - February 14, 2020
Alibaba Clouder - April 8, 2020
More Posts by Aliware