Spring Cloud中,Feign和Ribbon在整合了Hystrix后,可能会出现首次调用失败的问题,要如何解决该问题呢?
2019-01-28 16:19:46.074 INFO 3740 --- [nio-9790-exec-2] s.c.a.AnnotationConfigApplicationContext : Refreshing SpringClientFactory-ms-dyh-manufacturer: startup date [Mon Jan 28 16:19:46 CST 2019]; parent: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@15b986cd
2019-01-28 16:19:46.411 INFO 3740 --- [nio-9790-exec-2] f.a.AutowiredAnnotationBeanPostProcessor : JSR-330 'javax.inject.Inject' annotation found and supported for autowiring
2019-01-28 16:19:46.671 INFO 3740 --- [nio-9790-exec-2] c.netflix.config.ChainedDynamicProperty : Flipping property: ms-dyh-manufacturer.ribbon.ActiveConnectionsLimit to use NEXT property: niws.loadbalancer.availabilityFilteringRule.activeConnectionsLimit = 2147483647
2019-01-28 16:19:46.715 INFO 3740 --- [nio-9790-exec-2] c.n.u.concurrent.ShutdownEnabledTimer : Shutdown hook installed for: NFLoadBalancer-PingTimer-ms-dyh-manufacturer
2019-01-28 16:19:46.776 INFO 3740 --- [nio-9790-exec-2] c.netflix.loadbalancer.BaseLoadBalancer : Client: ms-dyh-manufacturer instantiated a LoadBalancer: DynamicServerListLoadBalancer:{NFLoadBalancer:name=ms-dyh-manufacturer,current list of Servers=[],Load balancer stats=Zone stats: {},Server stats: []}ServerList:null
2019-01-28 16:19:46.783 INFO

在Spring Cloud中,Feign和Ribbon整合Hystrix后可能出现首次请求失败的情况,主要原因是Hystrix默认1秒超时。解决办法包括:延长Hystrix超时时间、禁用Hystrix超时、全局禁用Feign的Hystrix、配置Ribbon饥饿加载和模拟请求预热。其中,Ribbon的饥饿加载是最佳实践,但在某些特定场景可能存在风险。
最低0.47元/天 解锁文章
167万+

被折叠的 条评论
为什么被折叠?



