Comparisons

  1. Failsafe vs Resilience4j
    1. General
    2. Async Support
    3. Policies
    4. Other Features
    5. References:
  2. Failsafe vs Hystrix
    1. General
    2. Async Support
    3. Policies
    4. References

Failsafe vs Resilience4j

Failsafe and Resilience4j are similar libraries in what they aim to offer users. They do provide different user experiences though, and also have some different features that are worth noting:

General

  • Failsafe has zero dependencies. Resilience4j depends on Vavr.
  • Failsafe provides a uniform interface for performing executions against any policy combination. Resilience4j supports varying execution decorators for different policies.
  • Failsafe offers a uniform ExecutionContext for any execution.

Async Support

Policies

  • Failsafe provides a uniform interface for failure handling and event handling configuration. Resilience4j provides distinct configurations for each policy.
  • Resilience4j offers Bulkhead, RateLimiter, and Cache policies, which Failsafe currently does not offer.
  • Failsafe circuit breakers can be used and operated as standalone constructs.

Other Features

  • Failsafe offers standalone execution support.
  • Failsafe provides strong typing across all of its APIs.
  • Failsafe offers an extensible SPI for implementing custom policies.
  • Resilience4j has a built-in named policy registry.
  • Resilience4j offers modules for integration with some 3rd party libraries.

References:

Failsafe vs Hystrix

Failsafe is intended to be a lightweight, general purpose library for handling any type of execution. Hystrix is more oriented around the execution of remote requests and offers additional features for that purpose. A few differences worth noting:

General

  • Failsafe has zero dependencies. Hystrix has several external dependencies including Archais, Guava, ReactiveX, and Apache Commons Configuration.
  • Failsafe offers several policies in addition to circuit breakers, which you can create and compose as needed. Hystrix is primarily an implementation of the circuit breaker and bulkhead patterns.
  • Failsafe allows executable logic via simple lambda expressions, Runnables, and Suppliers. Hystrix requires that executable logic be placed in a HystrixCommand implementation.

Async Support

Policies

  • Failsafe supports both count based and time based circuit breakers, with the ability to set any time window. Hystrix supports only time based circuit breakers, recording execution results per second, by default, and basing open/close decisions on the last second’s results.
  • Failsafe circuit breakers support configurable success thresholds. Hystrix only performs a single execution when in half-open state to determine whether to close a circuit.
  • Failsafe circuit breakers can be shared across different executions, so that if a failure occurs, all executions against that component will be halted by the circuit breaker.
  • Failsafe circuit breakers can be used and operated as standalone constructs.

References