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

  • 相关阅读:
    ASP.NET MVC3 中设置htmlAttribute
    oracle查看表空间的几个sql
    SQL Server 中 sysobjects表
    Openal简介
    [转]DBUSGLIB Binding,GLIB事件与DBUS事件是如何关联的
    ffmpeg简介
    ffmpeg安装FAAC
    ffserver error
    Openal教程(二)
    centos下安装qt时出现/usr/lib/libstdc++.so.6: version `GLIBCXX_3.4.9' not found
  • 原文地址:https://www.cnblogs.com/heavenTang/p/15389504.html
Copyright © 2011-2022 走看看