当前位置:网站首页>After openfeign sets circuitbreaker=true, feign's readtimeout expires
After openfeign sets circuitbreaker=true, feign's readtimeout expires
2022-07-23 23:56:00 【00 rounds II】
Because I use 2021 Version of Cloud, So start on the main configuration class Hystrix The annotation of has been changed ,
@EnableCircuitBreaker obsolete , The solution can be seen directly at the end .
And yml The configuration mode of the file has also changed , The configuration is as follows :
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
circuitbreaker:
enabled: trueOpen the annotation on the main configuration class @EnableHystrix( replace @EnableCircuitBreaker) 、@EnableFeignClients
@SpringBootApplication
@EnableFeignClients
@EnableHystrix
public class HystrixOpenFeign80 {
public static void main(String[] args) {
SpringApplication.run(HystrixOpenFeign80.class, args);
}
}Use @FeignClient Note on service Layer interface
@Component
@FeignClient(value = "CLOUD-PROVIDER-HYSTRIX-PAYMENT", fallback = PaymentHystrixServiceImpl.class)
public interface PaymentHystrixService {
When calling the specified service , The server takes time 3 second .
As a result, a service degradation call occurred fallback in PaymentHystrixServiceImpl Methods , That is to say, we configured readTimeout: 5000 It didn't work .
explain : Actually readTimeout: 5000 It has come into effect, but there is another judgment .
I thought the call :
By readTimeout To decide Feign Timeout of calling the server controller method , That's right , But before that, there is another place to determine whether the call timed out .
After the timeout DEBUG In the process of source code discovery :

Created through the factory HystrixCircuitBreaker object
The conclusion is that :Hystrix Timeout judgment of in Feign Timeout judgment time ,Hystrix The default timeout is 1 second .
So modify yml File to change Hystrix The default timeout of can solve the problem .
feign:
client:
config:
default:
connectTimeout: 5000
readTimeout: 5000
circuitbreaker:
enabled: true
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 5000边栏推荐
猜你喜欢
![[ssm] joint commissioning of front and rear console protocols ②](/img/ed/6a42e19f384fa0d4a039e52f5a95f4.png)
[ssm] joint commissioning of front and rear console protocols ②

【微服务架构】分布式事务

logback

ciscn_2019_c_1

bjdctf_2020_babystack

.NET下发同Outlook邮件格式以及表格的拼接

PushGateway+Prometheus+Grafana构建Flink实时监控

Deep learning 9 basic concepts of feedforward neural networks

warmup_ csaw_ two thousand and sixteen

Y75. Chapter IV Prometheus factory monitoring system and practice -- Prometheus alarm setting (VI)
随机推荐
太空射击 第07课: 添加图形
Create a linked list by head interpolation and output all elements
warmup_csaw_2016
为什么大多数人都认为编程很难?
PyTorch 中遇到的问题
Tool recommendation - YuQue
怎么开户买收益6%的理财产品呢?
Qt创建窗口被阻塞不能及时显示的问题
[three-year interview and five-year simulation] Dugu Jiujian secret script of Algorithm Engineer (first six style summary) V1 version
Chapter 4: implementation use cases
473-82(40、662、31、98、189)
浏览器无法访问minio
bjdctf_2020_babystack
pytorch中with torch.no_grad(): && model.eval()
ret2text
第五章、实现Web适配器
【细节】radio 标签 ,更换 默认选中的背景色
pwn1_ sctf_ two thousand and sixteen
ciscn_ 2019_ n_ one
中原证券靠谱吗?是否合法?开股票账户安全吗?