sriam980980
sriam980980

Reputation: 2028

How to enable Hystrix circuit breaker at zuul?

in my application we are using springboot microservices , with eureka registry, zuul api gateway, here assume I have 2 instances of payment-service, and the zuul is using ribbon for loadbalancing the /payment endpoint to the payment-service, when one node of the payment-service is unresponsive, and still registered with the eureka. here we have configured the hystrix circuit breaker at Zuul apigateway, but hystrix circuit breaker is not getting opened for the unresponsive node.

Upvotes: 1

Views: 5286

Answers (2)

sriam980980
sriam980980

Reputation: 2028

that can be achieved using ribbon, by changing the loadbalancing strategy to <ServiceName>: ribbon: NFLoadBalancerRuleClassName: com.netflix.loadbalancer.AvailabilityFilteringRule https://github.com/Netflix/ribbon/wiki/Working-with-load-balancers

Upvotes: 0

yongsung.yoon
yongsung.yoon

Reputation: 5589

Zuul creates a Hystrix circuit breaker for each route (serviceId). It means that one Hystrix circuit breaker will be shared between your all instances of payment-services.

The circuit breaker that Zuul creates for each route is not for removing an unhealthy instance from the routing list. It is just for preventing Zuul's down that can be caused by one kind of service's down.

Assumed that you're using the default configuration for Hystrix. If you have 3 instances of payment service and 2 instances among 3 are down, the circuit breaker for payment-service will be opened (because the default threshold of failure to open circuit is 50%). It means that all traffic to your payment services (including your one healthy instance) from Zuul will be blocked.

The thing that you want - removing an unhealthy instance from the routing list - is the role of Ribbon. Ribbon define many interfaces to define its behavior like IRule, IPing. Some of them have the ability that you want.

Upvotes: 2

Related Questions