Resilience4j vs Hystrix. What would be the best for fault tolerance?
Asked Answered
E

2

10

When I initially learn about spring boot, I've learnt about spring cloud netflix hystrix as a circuit breaker. There were bunch of options such as multiple application properties and annotation base declarations for fault tolerance. In-addition to that, it has few important threshold values as well. Most importantly hystrix the data can be prompted to hystrix dashboard via hystrix streams. With the use of turbine we can combine multiple hystrix streams and overview microservices. That is my experience from hystrix.

Now I have a requirement to implement Resilience4j which is basically supporting the same behaviour for fault tolerance. I am new to Resilience4j and I would like to know the main difference of these two fault tolerance options before getting started. According to my research Resilience4j is a robust option than hystrix. I would be grateful to know the expert facts and thank you.

Evocation answered 5/1, 2022 at 4:56 Comment(0)
L
6

I can say it really does not matter which implementation you choose unless there are specific requirements that would favor a particular implementation. I would not pick anything from Netflix Hystrix as it is in maintenance mode as of 2018 (https://spring.io/blog/2018/12/12/spring-cloud-greenwich-rc1-available-now). Read the Hystrix status at GitHub: https://github.com/Netflix/Hystrix#hystrix-status.

Let me emphasize this: "What I find more important from the architectural point of view is to enable an environment where it is easy to replace such implementation as needed."

I can recommend using Spring Cloud Circuit Breaker as a framework that has a consistent API and allows developers to pick the implementation: Netflix Hystrix, reactive or non-reactive Resilience4j, Sentinel, and Spring Retry.

All can be configured as necessary, and all provide a basic default configuration to change value thresholds, slow call thresholds, sliding window size, etc.

Leprose answered 2/6, 2022 at 4:36 Comment(0)
S
6

The most prominent difference between the two is the fact that while Hystrix embraces an Object-Oriented design where calls to external systems have to be wrapped in a HystrixCommand offering multiple functionalities, Resilience4J relies on function composition to let you stack the specific decorators you need.

Source: Circuit Breaker Pattern: Migrating From Hystrix to Resilience4J


Resilience4J is a standalone library inspired by Hystrix but build on the principles of Functional Programming. Resilience4J will be the best option to handle fault tolerance.

Stomach answered 2/6, 2022 at 4:22 Comment(0)
L
6

I can say it really does not matter which implementation you choose unless there are specific requirements that would favor a particular implementation. I would not pick anything from Netflix Hystrix as it is in maintenance mode as of 2018 (https://spring.io/blog/2018/12/12/spring-cloud-greenwich-rc1-available-now). Read the Hystrix status at GitHub: https://github.com/Netflix/Hystrix#hystrix-status.

Let me emphasize this: "What I find more important from the architectural point of view is to enable an environment where it is easy to replace such implementation as needed."

I can recommend using Spring Cloud Circuit Breaker as a framework that has a consistent API and allows developers to pick the implementation: Netflix Hystrix, reactive or non-reactive Resilience4j, Sentinel, and Spring Retry.

All can be configured as necessary, and all provide a basic default configuration to change value thresholds, slow call thresholds, sliding window size, etc.

Leprose answered 2/6, 2022 at 4:36 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.