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:


  • 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


  • Failsafe provides a uniform interface for failure handling and event handling configuration. Resilience4j configuration for these varies across policies.
  • Failsafe’s Timeout policy supports interrupts.
  • Failsafe’s RateLimiter supports smooth and bursty rate limiting.
  • Failsafe CircuitBreaker, RateLimiter, and Bulkhead can be used as standalone constructs.
  • Resilience4j offers a Cache policy, which Failsafe doesn’t.

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 some additional modules for 3rd party library integration.


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:


  • 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


  • 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.