Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 13, 2026·3 min de lectura

Hystrix — Latency and Fault Tolerance Library for Distributed Systems

Hystrix is a Netflix open-source library that isolates remote service calls, prevents cascading failures, and provides real-time monitoring dashboards for JVM-based microservice architectures.

Introduction

Hystrix implements the circuit breaker pattern for JVM applications. When a downstream service becomes slow or unavailable, Hystrix short-circuits requests and routes them to a fallback, protecting the calling service from cascading failures.

What Hystrix Does

  • Wraps remote calls in isolated thread pools or semaphores to contain failures
  • Opens a circuit breaker when error rates exceed a configurable threshold
  • Routes failed or timed-out requests to developer-defined fallback logic
  • Publishes real-time metrics via an event stream for the Hystrix Dashboard
  • Provides request caching and request collapsing for batching

Architecture Overview

Each Hystrix command runs inside its own thread pool (bulkhead pattern), preventing a slow dependency from consuming all application threads. A sliding-window health monitor tracks success, failure, timeout, and rejection rates. When failures cross the threshold, the circuit opens and all requests go to the fallback for a configurable sleep window before half-open probing resumes.

Self-Hosting & Configuration

  • Add hystrix-core as a Maven or Gradle dependency in any JVM project
  • Configure per-command thread pool sizes, timeouts, and circuit breaker thresholds via Archaius or static properties
  • Deploy the Hystrix Dashboard WAR alongside your service for real-time monitoring
  • Use Turbine to aggregate metrics streams across a cluster
  • Integrates with Spring Cloud Netflix for annotation-driven usage

Key Features

  • Bulkhead isolation keeps failing dependencies from taking down the whole service
  • Configurable circuit breaker with automatic recovery probing
  • Real-time streaming dashboard for observing command health
  • Request collapsing reduces fan-out by batching concurrent calls
  • Mature and battle-tested at Netflix scale

Comparison with Similar Tools

  • Resilience4j — modern lightweight successor designed for Java 8+; recommended for new projects since Hystrix is in maintenance mode
  • Sentinel (Alibaba) — broader flow control and system protection; more features but heavier
  • Polly (.NET) — equivalent circuit breaker library for the .NET ecosystem
  • Istio/Envoy — implements circuit breaking at the service mesh layer rather than in application code

FAQ

Q: Is Hystrix still maintained? A: Hystrix entered maintenance mode in 2018. Netflix recommends Resilience4j for new projects, but Hystrix remains stable and widely deployed.

Q: Can I use Hystrix without Spring Cloud? A: Yes. Hystrix is a standalone library; Spring Cloud Netflix is an optional integration layer.

Q: How does the circuit breaker decide when to open? A: It uses a rolling time window to track error percentages. When the error rate exceeds the configured threshold and minimum request volume, the circuit opens.

Q: Does Hystrix work with reactive frameworks? A: Hystrix includes an RxJava-based observable command variant for reactive pipelines.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados