Background
I'm using Spring cloud Brixton.RC2, with Zuul and Eureka.
I have one gateway service with @EnableZuulProxy
and a book-service
with a status
method. Via configuration I can emulate work on the status
method by sleeping a defined amount of time.
The Zuul route is simple
zuul.routes.foos.path=/foos/**
zuul.routes.foos.serviceId=reservation-service
I run two instances of the book-service
. When I set the sleeping time below the Hystrix timeout threshold (1000ms) I can see requests going to both instance of the book services. This works well.
Problem
I understand that if the Hystrix command fails, it should be possible for Ribbon to retry the command on a different server. This should make the failure transparent to the client.
I read the Ribbon configuration and added the following configuration in Zuul:
zuul.routes.reservation-service.retryable=true //not sure which one to try
zuul.routes.foos.retryable=true //not sure which one to try
ribbon.MaxAutoRetries=0 // I don't want to retry on the same host, I also tried with 1 it doesn't work either
ribbon.MaxAutoRetriesNextServer=2
ribbon.OkToRetryOnAllOperations=true
Now I update the configuration so that only one service sleeps for more than 1s, which means that I have one health service, and one bad one.
When I call the gateways the calls get send to both instances, and half the calls returns a 500. In the gateway I see the Hystrix timeout:
com.netflix.zuul.exception.ZuulException: Forwarding error
[...]
Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: reservation-service timed-out and no fallback available.
[...]
Caused by: java.util.concurrent.TimeoutException: null
Why isn't Ribbon retrying the call on the other instance?
Am I Missing something here?
References
- Relates to this question (not solved)
- Ribbon configuration
- According to this commit Zuul should support retries for Ribbon
reservation-service.ribbon.ConnectTimeout=250 reservation-service.ribbon.OkToRetryOnAllOperations=true reservation-service.ribbon.MaxAutoRetriesNextServer=2 reservation-service.ribbon.MaxAutoRetries=0
to my configuration but I'm afraid it does not fix the problem. – Fin