The bottom layer of Feign's load balancing is Ribbon. Feign's retry mechanism is disabled by default, so Ribbon is used to control timeout.
Solution
Configure the ribbon's ConnectTimeout and ReadTimeout
# ribbon load balancing
ribbon:
eager-load:
enabled: true # hungry loading (eager-load) mode
MaxAutoRetries: 1 # the number of retries for the current instance
MaxAutoRetriesNextServer: 2 # the number of retries for switching instances
ConnectTimeout: 10000 # connection timeout
ReadTimeout: 20000 # read data timeout
# hystrix circuit breaker
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 60000 # 60s, the execution timeout time of HystrixCommand when routing and forwarding, if the execution exceeds this time, the service will be degraded
—————————— —————
Copyright Statement: This article is an original article of CSDN blogger "Sima Cylinder Smashed the Cylinder", and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/yy756127197/article/details/106604654