`
234390216
  • 浏览: 10194177 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
博客专栏
A5ee55b9-a463-3d09-9c78-0c0cf33198cd
Oracle基础
浏览量:460821
Ad26f909-6440-35a9-b4e9-9aea825bd38e
springMVC介绍
浏览量:1771877
Ce363057-ae4d-3ee1-bb46-e7b51a722a4b
Mybatis简介
浏览量:1395481
Bdeb91ad-cf8a-3fe9-942a-3710073b4000
Spring整合JMS
浏览量:393917
5cbbde67-7cd5-313c-95c2-4185389601e7
Ehcache简介
浏览量:678253
Cc1c0708-ccc2-3d20-ba47-d40e04440682
Cas简介
浏览量:529320
51592fc3-854c-34f4-9eff-cb82d993ab3a
Spring Securi...
浏览量:1178774
23e1c30e-ef8c-3702-aa3c-e83277ffca91
Spring基础知识
浏览量:462010
4af1c81c-eb9d-365f-b759-07685a32156e
Spring Aop介绍
浏览量:150169
2f926891-9e7a-3ce2-a074-3acb2aaf2584
JAXB简介
浏览量:66890
社区版块
存档分类
最新评论

Spring Cloud(06)——断路器Hystrix

阅读更多

断路器Hystrix

Hystrix是Netflix实现的断路器,其github地址是https://github.com/Netflix/Hystrix。当对一个服务的调用次数超过了circuitBreaker.requestVolumeThreshold(默认是20),且在指定的时间窗口metrics.rollingStats.timeInMilliseconds(默认是10秒)内,失败的比例达到了circuitBreaker.errorThresholdPercentage(默认是50%),则断路器会被打开,断路器打开后接下来的请求是不会调用真实的服务的,默认的开启时间是5秒(由参数circuitBreaker.sleepWindowInMilliseconds控制)。在断路器打开或者服务调用失败时,开发者可以为此提供一个fallbackMethod,此时将转为调用fallbackMethod。Spring Cloud提供了对Hystrix的支持,使用时在应用服务的pom.xml中加入spring-cloud-starter-netflix-hystrix依赖。

<dependency>
    <groupId>org.springframework.cloud</groupId>
    <artifactId>spring-cloud-starter-netflix-hystrix</artifactId>
</dependency>

加入了依赖后,需要通过@EnableCircuitBreaker启用对断路器的支持。

@SpringBootApplication
@EnableCircuitBreaker
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class, args);
    }

}

假设有如下服务,在请求/hello/error时每次都会报错,且每次都会成功的访问到error(),这是因为此时没有声明需要使用断路器。

@RestController
@RequestMapping("hello")
public class HelloController {

    private int count;
    
    @GetMapping("error")
    public String error() {
        System.out.println(++count + " Error. " + LocalDateTime.now());
        throw new IllegalStateException();
    }
    
}

通过在error()添加@HystrixCommand可以声明该方法需要使用断路器保护,此时在指定的时间窗口内连续访问error()达到一定次数后,后续的请求将不再调用error(),因为此时断路器已经是打开的状态了。

@RestController
@RequestMapping("hello")
public class HelloController {

    private int count;
    
    @HystrixCommand
    @GetMapping("error")
    public String error() {
        System.out.println(++count + " Error. " + LocalDateTime.now());
        throw new IllegalStateException();
    }
    
}

 

fallback

在断路器打开或者服务调用出错的情况下,可以回退到调用fallbackMethod。下面的代码指定了当error()调用出错时将回退到调用fallback()方法,error()方法将count加1,fallback()也会将count加1,所以在调用error()时你会看到当断路器没有打开时,每次返回的count是加2的,因为error()加了一次,fallback()又加了一次,而当断路器打开后,每次返回的count只会在fallback()中加1。

private int count;

@HystrixCommand(fallbackMethod="fallback")
@GetMapping("error")
public String error() {
    String result = ++count + " Error. " + LocalDateTime.now();
    System.out.println(result);
    if (count % 5 != 0) {
        throw new IllegalStateException();
    }
    return result;
}

public String fallback() {
    return ++count + "result from fallback.";
}

在fallbackMethod中你可以进行任何你想要的逻辑,可以是进行远程调用、访问数据库等,也可以是返回一些容错的静态数据。

指定的fallbackMethod必须与服务方法具有同样的签名。同样的签名的意思是它们的方法返回类型和方法参数个数和类型都一致,比如下面的服务方法String error(String param),接收String类型的参数,返回类型也是String,它指定的fallbackMethod fallbackWithParam也必须接收String类型的参数,返回类型也必须是String。参数值也是可以正确传输的,对于下面的服务当访问error/param1时,访问error()传递的参数是param1,访问fallbackWithParam()时传递的参数也是param1

@HystrixCommand(fallbackMethod="fallbackWithParam")
@GetMapping("error/{param}")
public String error(@PathVariable("param") String param) {
    throw new IllegalStateException();
}

public String fallbackWithParam(String param) {
    return "fallback with param : " + param;
}

@HystrixCommand除了指定fallbackMethod外,还可以指定defaultFallback。defaultFallback对应的方法必须是无参的,且它的返回类型必须和当前方法一致。它的作用与fallbackMethod是一样的,即断路器打开或方法调用出错时会转为调用defaultFallback指定的方法。它与fallbackMethod的差别是fallbackMethod指定的方法的签名必须与当前方法的一致,而defaultFallback的方法必须没有入参,这样defaultFallback对应的方法可以同时为多个服务方法服务,即可以作为一个通用的回退方法。当同时指定了fallbackMethod和defaultFallback时,fallbackMethod将拥有更高的优先级。

@GetMapping("error/default")
@HystrixCommand(defaultFallback="defaultFallback")
public String errorWithDefaultFallback() {
    throw new IllegalStateException();
}

public String defaultFallback() {
    return "default";
}

 

配置commandProperties

@HystrixCommand还可以指定一些配置参数,通常是通过commandProperties来指定,而每个参数由@HystrixProperty指定。比如下面的示例指定了断路器打开衡量的时间窗口是30秒(metrics.rollingStats.timeInMilliseconds),请求数量的阈值是5个(circuitBreaker.requestVolumeThreshold),断路器打开后停止请求真实服务方法的时间窗口是15秒(circuitBreaker.sleepWindowInMillisecond)。

@HystrixCommand(fallbackMethod = "fallback", commandProperties = {
        @HystrixProperty(name = "circuitBreaker.requestVolumeThreshold", value = "5"),
        @HystrixProperty(name = "metrics.rollingStats.timeInMilliseconds", value = "30000"),
        @HystrixProperty(name = "circuitBreaker.sleepWindowInMilliseconds", value = "15000") })
@GetMapping("error")
public String error() {
    String result = ++count + " Error. " + LocalDateTime.now();
    System.out.println(result);
    if (count % 5 != 0) {
        throw new IllegalStateException();
    }
    return result;
}

public String fallback() {
    return count++ + "result from fallback." + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss SSS"));
}

受断路器保护的方法,默认的超时时间是1秒,由参数execution.isolation.thread.timeoutInMilliseconds控制,下面的代码就配置了服务方法timeout()的超时时间是3秒。

@GetMapping("timeout")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "3000"))
public String timeout() {
    try {
        TimeUnit.SECONDS.sleep(2);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "timeout";
}

也可以通过指定参数execution.timeout.enabledfalse来禁用超时,这样就不管服务方法执行多少时间都不会超时了。

 

控制并发

@HystrixCommand标注的服务方法在执行的时候有两种执行方式,基于线程的和基于SEMAPHORE的,基于线程的执行策略每次会把服务方法丢到一个线程池中执行,即是独立于请求线程之外的线程,而基于SEMAPHORE的会在同一个线程中执行服务方法。默认是基于线程的,默认的线程池大小是10个,且使用的缓冲队列是SynchronousQueue,相当于没有缓冲队列,所以默认支持的并发数就是10,并发数超过10就会被拒绝。比如下面这段代码,在30秒内只能成功请求10次。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"))
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(30);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

如果需要支持更多的并发,可以调整线程池的大小,线程池的大小通过threadPoolProperties指定,每个线程池参数也是通过@HystrixProperty指定。比如下面的代码指定了线程池的核心线程数是15,那下面的服务方法相应的就可以支持最大15个并发了。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", 
    commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"), 
    threadPoolProperties = @HystrixProperty(name = "coreSize", value = "15"))
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(30);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

也可以指定缓冲队列的大小,指定了缓存队列的大小后将采用LinkedBlockingQueue。下面的服务方法指定了线程池的缓冲队列是2,线程池的核心线程池默认是10,那它最多可以同时接收12个请求。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", 
    commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"), 
    threadPoolProperties = @HystrixProperty(name = "maxQueueSize", value = "2"))
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

当你指定maxQueueSize为100时,你的服务方法也只能同时容纳15个请求。这是因为默认队列的容量超过5后就会被拒绝,也就是说默认情况下maxQueueSize大于5时,队列里面也只能容纳5次请求。这是通过参数queueSizeRejectionThreshold控制的,加上这个控制参数的原因是队列的容量是不能动态改变的,加上这个参数后就可以通过这个参数来控制队列的容量。下面代码指定了队列大小为20,队列拒绝添加元素的容量阈值也是20,那队列里面就可以最大支持20个元素,加上默认线程池里面的10个请求,同时可以容纳30个请求。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"), 
    threadPoolProperties = {
        @HystrixProperty(name = "maxQueueSize", value = "20"),
        @HystrixProperty(name = "queueSizeRejectionThreshold", value = "20") })
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

这个线程池也是可以通过参数maximumSize配置线程池的最大线程数的,但是单独配置个参数时,最大线程数不会生效,需要配合参数allowMaximumSizeToDivergeFromCoreSize一起使用。它的默认值是false,配置成true后最大线程数就会生效了。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"), 
    threadPoolProperties = {
        @HystrixProperty(name = "maximumSize", value = "20"),
        @HystrixProperty(name = "allowMaximumSizeToDivergeFromCoreSize", value = "true")})
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

当最大线程数生效后,超过核心线程数的线程的最大闲置时间默认是1分钟,可以通过参数keepAliveTimeMinutes进行调整,单位是分钟。

如果需要同时指定队列大小和最大线程数,需要指定queueSizeRejectionThresholdmaxQueueSize大,否则最大线程数不会增长。

@GetMapping("concurrent")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = @HystrixProperty(name = "execution.timeout.enabled", value = "false"), 
    threadPoolProperties = {
        @HystrixProperty(name = "maximumSize", value = "15"),
        @HystrixProperty(name = "allowMaximumSizeToDivergeFromCoreSize", value = "true"), 
        @HystrixProperty(name = "maxQueueSize", value = "15"),
        @HystrixProperty(name = "queueSizeRejectionThreshold", value = "16")})
public String concurrent() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

需要服务方法的执行策略是基于SEMAPHORE的,需要指定参数execution.isolation.strategy的值为SEMAPHORE,其默认的并发数也是10。可以通过参数execution.isolation.semaphore.maxConcurrentRequests调整对应的并发数。

@GetMapping("concurrent/semaphore")
@HystrixCommand(defaultFallback = "defaultFallback", commandProperties = {
        @HystrixProperty(name = "execution.timeout.enabled", value = "false"),
        @HystrixProperty(name = "execution.isolation.strategy", value = "SEMAPHORE"),
        @HystrixProperty(name = "execution.isolation.semaphore.maxConcurrentRequests", value = "18") })
public String concurrentSemaphore() {
    System.out.println(LocalDateTime.now());
    try {
        TimeUnit.SECONDS.sleep(10);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "concurrent";
}

针对于fallback的并发数也是可以指定的,可以通过参数fallback.isolation.semaphore.maxConcurrentRequests指定。虽然该参数名中包含semaphore,但是该参数对于服务方法的执行策略都是有效的,不指定时默认是10。如果你的fallback也是比较耗时的,那就需要好好考虑下默认值是否能够满足需求了。

上面只是列举了一些常用的需要配置的hystrix参数,完整的配置参数可以参考https://github.com/Netflix/Hystrix/wiki/Configuration

 

DefaultProperties

当Controller中有很多服务方法都需要相同的配置时,我们可以不用把这些配置都加到各自的@HystrixCommand上,Hystrix提供了一个@DefaultProperties用于配置相同的参数。比如下面的代码就指定了当前Controller中所有的服务方法的超时时间是10秒,fallback的最大并发数是5。

@RestController
@RequestMapping("hystrix/properties")
@DefaultProperties(defaultFallback = "defaultFallback", commandProperties = {
        @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "10000"),
        @HystrixProperty(name = "fallback.isolation.semaphore.maxConcurrentRequests", value = "5") })
public class DefaultPropertiesController {

    @GetMapping("error")
    @HystrixCommand
    public String error() {
        throw new IllegalStateException();
    }
    
    //...
    
    public String defaultFallback() {
        return "result from default fallback.";
    }

}

 

在application.properties中配置参数

对于Spring Cloud应用来说,Hystrix的配置参数都可以在application.properties中配置。Hystrix配置包括默认配置和实例配置两类。对于@HystrixCommand的commandProperties来说,默认的配置参数是在原参数的基础上加上hystrix.command.default.前缀,比如控制执行的超时时间的参数是execution.isolation.thread.timeoutInMilliseconds,那默认的配置参数就是hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds。对于@HystrixCommand的threadPoolProperties来说,默认的配置参数是在原参数的基础上加上hystrix.threadpool.default.前缀,比如线程池的核心线程数由参数coreSize控制,那默认的配置参数就是hystrix.threadpool.default.coreSize。如果我们的application.properties中定义了如下配置,则表示@HystrixCommand标注的方法默认的执行超时时间是5秒,线程池的核心线程数是5。

hystrix.command.default.execution.isolation.thread.timeoutInMilliseconds=5000
hystrix.threadpool.default.coreSize=5

默认值都是可以被实例上配置的参数覆盖的,对于上面配置的默认参数,如果拥有下面这样的实例配置,则下面方法的执行超时时间将使用默认的5秒,而最大并发数(即核心线程数)是代码里面配置的6。

@GetMapping("timeout/{timeout}")
@HystrixCommand(threadPoolProperties=@HystrixProperty(name="coreSize", value="6"))
public String timeoutConfigureWithSpringCloud(@PathVariable("timeout") long timeout) {
    System.out.println("Hellooooooooooooo");
    try {
        TimeUnit.SECONDS.sleep(timeout);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "timeoutConfigureWithSpringCloud";
}

实例的配置参数也是可以在application.properties中配置的,对于commandProperties,只需要把默认参数名称中的default换成实例的commandKey即可,commandKey如果不特意配置时默认是取当前的方法名。所以对于上面的timeoutConfigureWithSpringCloud方法,如果需要指定该实例的超时时间为3秒,则可以在application.properties中进行如下配置。

hystrix.command.timeoutConfigureWithSpringCloud.execution.isolation.thread.timeoutInMilliseconds=3000

方法名是很容易重复的,如果不希望使用默认的commandKey,则可以通过@HystrixCommand的commandKey属性进行指定。比如下面的代码中就指定了commandKey为springcloud。

@GetMapping("timeout/{timeout}")
@HystrixCommand(commandKey="springcloud")
public String timeoutConfigureWithSpringCloud(@PathVariable("timeout") long timeout) {
    System.out.println("Hellooooooooooooo");
    try {
        TimeUnit.SECONDS.sleep(timeout);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "timeoutConfigureWithSpringCloud";
}

那如果需要指定该方法的超时时间为3秒,需要调整对应的commandKey为springcloud,即如下这样:

hystrix.command.springcloud.execution.isolation.thread.timeoutInMilliseconds=3000

对于线程池来说,实例的配置参数需要把默认参数中的default替换为threadPoolKey,@HystrixCommand的threadPoolKey的默认值是当前方法所属Class的名称,比如当前@HystrixCommand方法所属Class的名称是HelloController,可以通过如下配置指定运行该方法时使用的线程池的核心线程数是8。

hystrix.threadpool.HelloController.coreSize=8

下面代码中手动指定了threadPoolKey为springcloud。

@GetMapping("timeout/{timeout}")
@HystrixCommand(commandKey="springcloud", threadPoolKey="springcloud")
public String timeoutConfigureWithSpringCloud(@PathVariable("timeout") long timeout) {
    System.out.println("Hellooooooooooooo");
    try {
        TimeUnit.SECONDS.sleep(timeout);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    return "timeoutConfigureWithSpringCloud";
}

如果需要指定它的线程池的核心线程数为3,则只需要配置参数hystrix.threadpool.springcloud.coreSize的值为3。

hystrix.threadpool.springcloud.coreSize=3

关于Hystrix配置参数的默认参数名和实例参数名的更多介绍可以参考https://github.com/Netflix/Hystrix/wiki/Configuration

关于Hystrix的更多介绍可以参考其GitHub的wiki地址https://github.com/netflix/hystrix/wiki

 

参考文档

https://github.com/netflix/hystrix/wiki https://github.com/Netflix/Hystrix/wiki/Configuration http://cloud.spring.io/spring-cloud-static/Finchley.SR1/multi/multi__circuit_breaker_hystrix_clients.html

(注:本文是基于Spring cloud Finchley.SR1所写)

0
0
分享到:
评论

相关推荐

    SpringCloud——断路器(Hystrix)

    SpringCloud——断路器(Hystrix)之Ribbon使用断路器和Feign使用断路器

    【微服务架构】SpringCloud之断路器(hystrix)

    【微服务架构】SpringCloud之断路器(hystrix)https://blog.csdn.net/u012081441/article/details/80814250

    Spring Cloud Netfix Hystrix断路器例子

    Spring Cloud Netfix Hystrix断路器例子工程。使用Spring Cloud Netflix Hystrix以及Spring RestTemplate或Spring Cloud Netflix Feign实现断路器模式。

    25-Spring Cloud断路器Hystrix1

    Spring Cloud断路器Hystrix上文讲到我们服务间调用使用Feign——声明式Web服务客户端,在分布式系统中,一个服务很可能会调用多个其他微服务,

    Spring boot,springCloud精选视频教程

    10.Spring Cloud中的断路器Hystrix 11.Spring Cloud自定义Hystrix请求命令 12.Spring Cloud中Hystrix的服务降级与异常处理 13.Spring Cloud中Hystrix的请求缓存 14.Spring Cloud中Hystrix的请求合并 15.Spring ...

    SpringCloud中的断路器(Hystrix)和断路器监控(Dashboard)

    本篇主要介绍的是SpringCloud中的断路器(Hystrix)和断路器指标看板(Dashboard)的相关使用知识,需要的朋友可以参考下

    SpringCloud服务容错保护(Hystrix)介绍与使用示例

    SpringCloud服务容错保护(Hystrix)介绍与使用示例 在微服务架构中,一个服务可能会调用很多的其他微服务应用,虽然做了多集群部署,但可能还会存在诸如网络原因或者服务提供者自身处理的原因,或多或少都会出现请求...

    74-Spring Cloud断路器Hystrix原理读书笔记1

    2.2、否,进入3 3.2、否,进入4 5.2、否,进入6 6.2、否,至此执行成功,返回结果 7.2、否,抛异常

    SpringCloud断路器Hystrix原理及用法解析

    主要介绍了SpringCloud断路器Hystrix原理及用法解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

    Spring Cloud.docx

    Spring Cloud(五)断路器监控(Hystrix Dashboard) spring-cloud-zuul Spring Cloud(六)服务网关 zuul 快速入门 spring-cloud-zuul-filter Spring Cloud(七)服务网关 Zuul Filter 使用 spring-...

    尚硅谷SpringCloud第2季2020版.mmap

    Hystrix断路器 zuul路由网关 Gateway新一代网关 SpringCloud Config 分布式配置中心 SpringCloud Bus 消息总线 SpringCloud Stream 消息驱动 SpringCloud Sleuth 分布式请求链路跟踪 SpringCloud Alibaba入门...

    尚硅谷SpringCloud视频(最新)

    38.尚硅谷_SpringCloud_Hystrix断路器是什么 39.尚硅谷_SpringCloud_服务熔断 40.尚硅谷_SpringCloud_服务降级 41.尚硅谷_SpringCloud_服务降级熔断小总结 42.尚硅谷_SpringCloud_豪猪hystrixDashboard 43.尚硅谷_...

    SpringCloud五大组件及中间件方案报告

    讲到了Spring Cloud五大...Hystrix断路器的监控 Spring Cloud的网关 有赞网关架构 Spring Cloud Zuul 统一配置中心的架构图 Spring Cloud Config工作流程简图 全链路监控应该的功能 Spring cloud Sleth与PinPoint集成

    springCloud项目练习

    第四课: 断路器(Hystrix) 第五课: 路由网关(zuul) 第六课: 分布式配置中心(Spring Cloud Config) 第七课: 高可用的分布式配置中心(Spring Cloud Config) 第八课: 消息总线(Spring Cloud Bus) 第九课: 服务...

    想学习的看过来了spring4.0、springboot、springcloud详细视频课程(硅谷)

    38.硅谷学习_SpringCloud_Hystrix断路器是什么 39.硅谷学习_SpringCloud_服务熔断 40.硅谷学习_SpringCloud_服务降级 41.硅谷学习_SpringCloud_服务降级熔断小总结 42.硅谷学习_SpringCloud_豪猪hystrix...

    springcloud项目实战微服务架构源代码+文档说明(电商版一套完整架构)

    使用 SpringCloud Eureka作为注册中心、Feign客户端调用工具、断路器Hystrix 视图展示使用Freemarker、数据库层使用Mybatis框架、缓存使用Redis、数据库使用MySQL 项目管理工具使用Maven、版本控制工具使用SVN、项目...

    断路器hystrix实现.rar

    在微服务中,利用hystrix实现断路器,在服务之间的调用失败、超时等情况后进行指定的降级处理,使接口的返回结果更友好。

    详解Spring Cloud Hystrix断路器实现容错和降级

    本篇文章主要介绍了详解Spring Cloud Hystrix断路器实现容错和降级,小编觉得挺不错的,现在分享给大家,也给大家做个参考。一起跟随小编过来看看吧

    spring boot+spring cloud视频教学下载全套

    ├19 5.1超时机制,断路器模式简介.avi ├2 1.1 微服务架构概述.avi ├20 5.2 Hystrix简介及简单代码示例.avi ├20 5.2Hystrix简介及简单代码事例.avi ├21 Hystrix Health Indicator及Metrics Stream.avi ├22 5.4 ...

Global site tag (gtag.js) - Google Analytics