0

I have configured my project architecture using Spring Boot, Eureka, Zuul, Ribbon frameworks. Its working fine but sometimes (rarely) getting the following exceptions:

  1. Caused by: com.netflix.client.ClientException: Load balancer does not have available server for client: service1
  2. Caused by: com.netflix.hystrix.exception.HystrixRuntimeException: service1 timed-out and no fallback available.

Below are my services configurations: Have a look and please let me know if I missed anything which causing the issues for above exceptions.

eureka service application.properties:

server.port=8070
spring.application.name=eureka_service
eureka.client.register-with-eureka=false
eureka.client.fetch-registry=false
eureka.instance.hostname=localhost
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:8070/eureka/
logging.level.com.netflix.eureka=OFF
logging.level.com.netflix.discovery=OFF

zuul service application.properties:

server.port=8071
spring.application.name=zuul_service
zuul.prefix=/api
zuul.routes.service1.path=/service1/**
zuul.routes.service1.service-id=service1
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.instance.hostname=localhost
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:8070/eureka/
ribbon.eureka.enabled=true

service1 application.properties:

server.port=8072
spring.application.name=service1
eureka.client.register-with-eureka=true
eureka.client.fetch-registry=true
eureka.instance.hostname=localhost
eureka.client.service-url.defaultZone=http://${eureka.instance.hostname}:8070/eureka/
ribbon.eureka.enabled=true

Please let me know if I need to add any other configuration to resolve ? Thanks.

Krish
  • 1,804
  • 7
  • 37
  • 65
  • Are these exceptions on start up? It can take 120 seconds, if you are unlucky, for the meta data to be shared for discovery between services. Additionally Hystrix has a default 1 second timeout with a threadpool of 10, you can easily DOS yourself if you keep Hystrix defaults. – Darren Forsythe Oct 28 '17 at 12:50
  • @DarrenForsythe These exceptions NOT on startup. I am getting when I tried to access the service1 API via Zuul. http://localhost:8071/api/security1/user/***** How can I resolve these exceptions ? – Krish Oct 28 '17 at 13:18
  • I should clarify, how quickly after the applications come up are you trying to hit the APIs? – Darren Forsythe Oct 28 '17 at 14:02
  • @DarrenForsythe I tried to hit the APIs after all services are UP and running and after ensuring all services registered successfully on Eureka server. I am getting these exceptions, sometimes for API 1st hit after server started, sometimes after several hits. I am not getting what is the issue !!! – Krish Oct 30 '17 at 08:28

1 Answers1

0

You can try to increase the Ribbon timeout by setting for example:

ribbon.ReadTimeout=10000

If above code doesn't work you can try by disabling the timeout:

hystrix.command.default.execution.timeout.enabled=false
juanlumn
  • 6,155
  • 2
  • 30
  • 39