spring cloud netflix hystrix的替代产品

本文介绍了SpringCloud自2020.0版本起移除Netflix组件Hystrix的情况,推荐使用Resilience4j和阿里巴巴的Sentinel作为替代品,同时指出Eureka仍在可用。
摘要由CSDN通过智能技术生成

spring cloud 整合了 netflix 的一个很多的熔断处理的组件,即 hystrix。是断路器思想的实现。

但是在最后一个版本 1.5.18 在 2018.11.16 发布后,进入了维护模式,即没有新特性对外发布了,即使有问题也只能那样了。

spring cloud netflix hystrix

https://github.com/Netflix/Hystrix

 

在 spring cloud 的依赖中,通过如下方式引入

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

其中,相关的定义在 spring cloud dependencies 中

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.cloud</groupId>
				<artifactId>spring-cloud-dependencies</artifactId>
				<version>Hoxton.SR12</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

通过如下链接得知,spring-cloud-starter-netflix-hystrix 在 spring cloud 2020.0.0 中被移除。

https://github.com/spring-cloud/spring-cloud-release/wiki/Spring-Cloud-2020.0-Release-Notes

然而 spring cloud 2020.0.0 对应的 spring boot 版本为 2.4.x,即从 spring boot 2.4.x 开始,如果想要使用 hystrix,需要考虑到兼容性问题,因为 spring 官方已经把相关的依赖去除了。

 其中对应的 spring cloud netflix 组件版本为 3.0.0

https://github.com/spring-cloud/spring-cloud-netflix/tree/v3.0.0

由此可见,从 spring cloud 2020.0.0(对应 spring boot 2.4.x) 开始,netflix 的几大组件,hystrix(熔断)、ribbon(负载均衡)、zuul(网关)、eureka(注册中心),除了 eureka 外,其他全部不能用了。能确保没问题的最新版本是 spring cloud Hoxton.SR12(对应 spring boot 2.3.12.RELEASE)。

3.0.0 版本之前 spring 的文档里有 netflix 组件的介绍使用。

https://docs.spring.io/spring-cloud-netflix/docs/2.2.9.RELEASE/reference/html/

https://docs.spring.io/spring-cloud-netflix/docs/2.2.10.RELEASE/reference/html/

从 3.0.0 版本开始 spring 的文档里有 netflix 组件介绍使用但是除了 eureka 的都去掉了。

https://docs.spring.io/spring-cloud-netflix/docs/3.0.0/reference/html/

从如下链接得知,在 spring-cloud-commons 2.2.9.RELEASE 还有 hystrix。

https://docs.spring.io/spring-cloud-commons/docs/2.2.9.RELEASE/reference/html/#spring-cloud-circuit-breaker

从如下链接得知,从 spring-cloud-commons 3.0.0 开始,去掉了 hystrix。

https://docs.spring.io/spring-cloud-commons/docs/3.0.0/reference/html/#spring-cloud-circuit-breaker

替代产品

resilience4j

在上面的 hystrix 介绍中,建议使用 resilience4j 替换掉 hystrix。

https://github.com/resilience4j/resilience4j

https://resilience4j.readme.io/

https://github.com/lmhmhl/Resilience4j-Guides-Chinese/blob/main/index.md

alibaba sentinel

国内有一个阿里巴巴开源的 sentinel,用于熔断降级处理。

https://sentinelguard.io/zh-cn/docs/introduction.html

https://github.com/alibaba/Sentinel

国内做的东西一直有一个通病,就是文档少。

  • 15
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值