Comparisons

Jonathan Halterman edited this page Jan 28, 2017 · 4 revisions

Failsafe vs Hystrix

Failsafe is intended to be lightweight and to blend as seamlessly into your code as possible while Hystrix appears a bit more imposing but offers many more features as a result, such as response caching, request collapsing and threadpool management. Generally, Hystrix is more oriented around the execution of remote requests and offers features around that while Failsafe is more general purpose for handling any type of execution and failure. To highlight a few differences:

  • Executable logic can be passed to Failsafe as simple lambda expressions, method references, Callables or Runnables. In Hystrix, your executable logic needs to be placed in a HystrixCommand implementation.
  • Failsafe supports retries in addition to circuit breakers.
  • Asynchronous executions in Failsafe are performed on a user supplied ThreadPool / Scheduler. In Hystrix, asynchronous commands are executed on internally managed thread pools for particular dependencies.
  • In Failsafe, asynchronous executions can be observed via the event listeners API and return Future. In Hystrix, asynchronous executions can be observed using RxJava Observables.
  • Hystrix circuit breakers are time sensitive, recording execution results per second (by default) and basing open/close decisions on the last second's results. Failsafe circuit breakers are not time sensitive, basing open/close decisions on the last N (configured) executions, regardless of when they took place.
  • Failsafe circuit breakers support execution timeouts and 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 against the same component (such as a web service), 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.

Reference: https://github.com/Netflix/Hystrix/wiki/How-it-Works

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.