Hystrix
Hystrix is a latency and fault tolerance library designed to isolate points of access to remote systems, services and 3rd party libraries, stop cascading failure and enable resilience in complex distributed systems where failure is inevitable.
A Java library from Netflix that keeps distributed backend systems running when individual services fail, using the circuit breaker pattern to stop cascading failures and return safe fallback responses instead.
Hystrix is a Java library from Netflix designed to make distributed systems more resilient when individual components fail. In a complex application made up of many services that call each other, one slow or failing service can cause a chain reaction that takes down everything — this is called cascading failure. Hystrix was built to prevent that.
It does this through the circuit breaker pattern. A circuit breaker monitors calls to a dependency (like another service or database). If that dependency starts failing or responding too slowly too often, the circuit breaker trips open and stops sending it requests. Instead, a fallback response is returned immediately — for example, a cached result or a default value — so the rest of the system keeps functioning while the problem is isolated and the dependency has time to recover.
Hystrix also supports running calls in isolated thread pools and request caching, so a misbehaving dependency cannot exhaust shared resources and bring everything else down with it.
You would use Hystrix in Java backend systems that call multiple external services, databases, or third-party APIs, and where you need graceful degradation under failure conditions.
Note: Hystrix is no longer actively developed and is in maintenance mode. Netflix recommends resilience4j for new projects.
The tech stack is Java.
Where it fits
- Wrap calls to an external API so your app returns a cached fallback instead of crashing when that API goes down.
- Prevent one slow database query from exhausting all threads and bringing down an entire Java microservice.
- Isolate third-party service calls into separate thread pools so a failing vendor cannot affect your core logic.
- Monitor which dependencies are failing most often in a distributed Java system.