加入收藏 | 设为首页 | 会员中心 | 我要投稿 扬州站长网 (https://www.0514zz.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 云计算 > 正文

聊聊SpringCloud与云原生 你明不明白

发布时间:2022-10-26 16:16:47 所属栏目:云计算 来源:
导读:  很多公司由于历史原因,都会有自研的RPC框架。

  尤其是在2015-2017期间,Spring Cloud刚刚面世,Dubbo停止维护多年,很多公司在设计自己的RPC框架时,都会基于Spring Cloud做二次开发。并且会大量使用Spr
  很多公司由于历史原因,都会有自研的RPC框架。
 
  尤其是在2015-2017期间,Spring Cloud刚刚面世,Dubbo停止维护多年,很多公司在设计自己的RPC框架时,都会基于Spring Cloud做二次开发。并且会大量使用Spring Cloud Netflix相关的模块与代码。
 
  因此,我们去梳理一下Spring Cloud的前世今生,以及未来云原生发展的趋势,可以给这些RPC框架的演进带来一些启发。
 
  1、Spring Cloud的历史
  Spring Cloud 自 2015 年 3 月推出之后,很快就在 Java 微服务生态中,成为开发人员的首选技术栈。
 
  Spring Cloud 在 Spring Boot 的基础上,保留 Java 开发习惯,加入分布式特性,提供了一系列通用工具来帮助开发者在分布式系统里快速构建一些常见模式,现在已成为使用范围最广的微服务架构之一。
 
  Spring Cloud提供了微服务开发所需的配置管理、服务发现、断路器、智能路由、集群状态管理等组件。最重要的是,跟Spring Boot框架一起使用的话,会让你开发微服务架构非常方便。
 
  Spring Cloud本身不是新的框架,它是一系列框架的有机组合,利用Spring Boot的开发便利性巧妙地简化了分布式系统基础设施的开发。
 
  注意,并非所有组件都由Spring提供,Netflix扮演了重要的角色。注册中心Eureka、熔断器Hystrix、负载均衡组件Ribbon、网关Zuul等重要组件均由Netflix提供,主要贡献来自 Netflix OSS。
 
  2、Spring Cloud的现在
  由于Netflix在开源投入上的策略调整,Eureka、Hystrix、Ribbon 相继宣布停止维护,社区上人心惶惶,因为当时绝大部分开发者认为 Spring Cloud = Spring Cloud Netflix。
 
  但实际上 Spring Cloud 是一套规范,这套规范并不是只有 Netflix OSS,还有 Spring Cloud Alibaba,Spring Cloud Zookeeper,Spring Cloud Consul,Spring Cloud Kubernetes 这些实现,最近腾讯也开源了Spring Cloud Tencent(暂时还没有进入Spring Cloud 官方社区)。
 
  2.1 Spring Cloud Alibaba
  Spring Cloud Alibaba(后面简称SCA) 是目前国内Spring Cloud最活跃、组件最多,也是最容易替代 Spring Cloud Netflix 的实现。
 
  下面张图对相关功能和组件的映射关系表达得比较清晰了。
 
  图片
 
  (来源:https://www.oschina.net/question/4489239_2321891)
 
  我们可以看到,SCA对Spring Cloud的实现,采用了几个目前非常热门的项目,基本上可以做到快速接入,稳定使用。
 
  不过这里有个地方需要注意,从SCA 的2.2.7-RELEASE版本后,不再支持dubbo的快速接入了,而是直接使用了Spring Cloud的原生调用方式(OpenFeign和RestTemplate)。
  
  首先,Spring Cloud认为自己还是比较符合云原生的
 
  from https://github.com/spring-cloud/spring-cloud-commons:
 
  Cloud Native is a style of application development that encourages easy adoption of best practices in the areas of continuous delivery and value-driven development. A related discipline is that of building 12-factor Applications, in which development practices are aligned with delivery and operations goals — for instance, by using declarative programming and management and monitoring. Spring Cloud facilitates these styles of development in a number of specific ways. The starting point is a set of features to which all components in a distributed system need easy access.
 
  与Spring Cloud体系一样闻名的Dubbo体系,我们已经可以看到dubbo 3.x从 Mesh 到 Proxyless 对云原生的全面拥抱。
 
  不仅从服务注册发现模型上做了彻底改变(接口级别变成了应用级别),也在治理能力上对接xds。
 

(编辑:扬州站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!