Post

Building Resilient Systems: Circuit Breakers with Hystrix

A recent production issue reminded us: never trust remote systems to behave.

We integrated Netflix Hystrix to wrap remote calls with:

  • Circuit breaker
  • Timeout
  • Fallback

Sample snippet:

1
2
3
4
5
6
7
8
9
@HystrixCommand(fallbackMethod = "defaultResponse")
public String getProfile(String id) {
    return profileService.call(id);
}

public String defaultResponse(String id) {
    return "unavailable";
}

One timeout shouldn’t bring down your system. Hystrix made sure of that.

This post is licensed under CC BY 4.0 by the author.