Netflix / zuul

Zuul is a gateway service that provides dynamic routing, monitoring, resiliency, security, and more.
Apache License 2.0
13.45k stars 2.37k forks source link

Zuul timeout randomly with pending requests #487

Open Bogad opened 6 years ago

Bogad commented 6 years ago

I have a microservice application which use Zuul as an api gateway(Edgware.SR4) The problem is, random pending requests through the day and a simple refresh make the request successeful again. My application is deployed on traefik My config is below

application.yml.txt

itors commented 6 years ago

In your configuration: zuul.ribbon.eager-load.enabled=true . But your zuul is configured with URL, directly configuring URL routing, not using Ribbon or Hystrix, Zuul forwarding filter is org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilter, in which Zuul makes Apache HttpClient to be forwarded. The main reason for the failure of the first service call is that the Ribbon's client load balanced Client is not initialized when the service is started, but the corresponding Client is created when the call is called, so the time of the first call contains not only the time that the HTTP request is sent, but also the creation. Build RibbonClient time so that if the time of creation is slower and the timeout time set is short, it is easy to show the appearance of what you describe, and the problem disappears when it is refreshed second times.You can add retry mechanism to solve this problem

Bogad commented 6 years ago

thanks @itors