Resilience
Resilience keeps your applications available when the remote APIs they depend on slow down or fail. HARP sits between your code and those APIs and adds resilience without changing the application: it spreads traffic across the URLs of each remote in round-robin and, once you enable its circuit breaker, takes failing URLs out of the pool, lets fallback URLs join when it drops below min_pool_size, and, with a probe set, checks them with healthcheck probes. This page explains how each one helps, and what works with no configuration.
Understanding the use case
Most failures that hurt an application come from systems it does not fully control, such as third-party APIs and external services. A single slow or failing dependency can trigger a cascading failure, where one weak component drags the rest of the system down with it. Because HARP proxies every external call, it can, with a liveness algorithm set, take a failing URL out of the pool; it comes back after a probe succeeds; without a probe, when you bring it back from the dashboard or HARP restarts, without you touching application code.
What works by default
With no configuration, round-robin works: HARP spreads requests across the URLs of each remote. The circuit breaker needs a liveness algorithm, and a probe only acts through one.
Challenges and solutions
-
A call that fails: Third-party APIs are unpredictable. With the circuit breaker enabled, HARP takes the failing URL out of the pool, so the next requests go to the remaining URLs.
-
Cascading failures: When a dependency starts failing repeatedly, continuing to call it makes things worse. HARP's circuit breaker tracks each remote URL through three states. When failures are detected it opens and stops routing traffic to that URL. The URL comes back after a probe succeeds; without a probe, when you bring it back from the dashboard or HARP restarts. If no URL is left in the active pool, the proxy returns a 503 until one recovers. The circuit breaker is disabled by default and is enabled by selecting a liveness algorithm.
-
Detecting failures early: Each remote can have a healthcheck probe, sent regularly to every URL of the remote. With the circuit breaker enabled, a URL whose probe fails leaves the active pool before it affects more traffic. See Health monitoring.
-
Handling unavailable services: List fallback URLs and your application still has somewhere to send requests: they join the pool when it drops below
min_pool_size(1 by default), once the circuit breaker has taken the failing URLs out. -
Distributing load: Sending all traffic to one instance leads to overload and slowdowns. HARP uses the URLs in a remote pool in a round-robin manner, spreading requests across instances so no single one takes all the traffic.