zoukankan      html  css  js  c++  java
  • 第二篇 【Zuul、Ribbon、Feign、Hystrix使用时的超时时间(timeout)设置问题】【转】

    Zuul、Ribbon、Feign、Hystrix使用时的超时时间(timeout)设置问题

    基于第一篇的Ribbon、Hystrix使用时的超时时间(timeout)设置问题, 我接触的项目的网关是用zuul转发服务的,那对于这类的该如何配置超时呢,要特别注意哪些呢,我遇到的坑,终于解决了。

    工具

    Idea

    Spring Boot 2.0.5.RELEASE

    Eureka 1.9.3

    Zuul 1.3.1

    Ribbon 2.2.5

    Feign 9.5.1

    Hystrix 1.5.12

    Feign + Hystrix

    0. 默认基本配置

    最基本的配置,是 Hystrix 自己的一长串配置:hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds,但在 Feign 模块中,单独设置这个超时时间不行,还要额外设置 Ribbon 的超时时间,比如:

    image

    关于 Hystrix 的配置,这里有官方说明

    Default Value 1000
    Default Property hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds
    Instance Property hystrix.command.HystrixCommandKey.execution.isolation.thread.timeoutInMilliseconds
    How to Set Instance Default HystrixCommandProperties.Setter().withExecutionTimeoutInMilliseconds(int value)

    可以看到实例配置中,替代 default 的,是 HystrixCommandKey,这个值在下面会说到

    1. 不同实例分别配置

    如果更进一步,想把超时时间细分到不同的 service 实例上也可以实现,比如:

    image

  • 相关阅读:
    CF 842A
    Codeforces 842B
    CodeForces
    CodeForces 359A Table
    Find them, Catch them POJ
    剪花布条 HDU
    关于map的学习笔记
    ASP.NET MVC 中将数据从View传递到控制器中的三种方法(表单数据绑定)
    SQL Delta实用案例介绍 (对应软件)
    SQL Select count(*)和Count(1)的区别和执行方式及SQL性能优化
  • 原文地址:https://www.cnblogs.com/heavenTang/p/15389504.html
Copyright © 2011-2022 走看看