Feign [first] request failed

When feign and ribbon integrate hystrix, problems may arise for the first time call fails, the emergence of reasons as follows:

hystrix default timeout is one second, if the interface in response to request more than this time will perform fallback, spring loaded mechanism assembly reasons bean and lazy, Feign are relatively slow first request, if the request over one second, will emergence request failed.

Here three treatments:

1, the hystrix timeout to 5 seconds, configured as follows:

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=60000

2, disabling hystrix timeout, configured as follows:

hystrix.command.default.execution.timeout.enabled=false

3, use feign time, directly off hystrix, do not recommend this approach:

feign.hystrix.enabled=false

For the first time feign request fails, you can refer to: https://github.com/spring-cloud/spring-cloud-netflix/issues/768

Guess you like

Origin www.cnblogs.com/idoljames/p/11682173.html