微服务之SpringCloud Alibaba

2018年10月31日,Spring Cloud Alibaba正式入驻了Spring Cloud官方孵化器,并在maven中央库发布了第一个版本

Spring Cloud Alibaba:

很多人虽然在用Spring Cloud,但其实并不了解Spring Cloud到底是什么,只知道开发微服务,可以选择使用Spring Cloud。首先来看看Spring Cloud官方的介绍,其实这一句话基本说出了Spring Cloud的本质。

  Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems.Coordination of distributed systems leads to boiler plate patterns, and using Spring Cloud developers can quickly stand up services and applications that implement those patterns. They will work well in any distributed environment, including the developer's own laptop, bare metal data centres, and managed platforms such as Cloud Foundry.

  翻译:Spring Cloud提供了一些工具,可以让开发者快速构建基于一些通用模式的分布式应用。分布式应用的协调都遵循“锅炉板模式”(boiler plate patterns),使用Spring Cloud以后,开发者可以更快的构建实现了这些模式的服务和应用。而这些服务和应用,也可以很好的工作在任何分布式环境,包括开发者自己的笔记本,裸金属数据中心以及像Cloud Foundry这样的托管平台。

从Spring Cloud官方文档里,我们可以摘取到Spring的核心功能。

Distributed/versioned configuration【分布式以及版本化的配置】

Service registration and discovery【服务注册与发现】

Routing【路由】

Service-to-service calls【服务调用】

Load balancing【负载均衡】

Circuit Breakers【断路器】

Distributed messaging【分布式消息】

不难发现,其实上面这些功能,就是开发微服务架构下的分布式应用,会经常用到的。不过,Spring团队厉害的地方就在于,他们很少会重复造轮子,而是让别人帮他们来造轮子。比如最早的Spring framework,Spring只是提供了IOC和AOP的核心功能,而具体的MVC框架、ORM框架、缓存等等,Spring都只是提供了很好的支持和兼容,并不会去自己实现一个。当然,除非是对方做的不够好,比如Spring MVC,就是因为当初的Struts2有着诸多的缺陷,才应运而生,并且很快就替代掉了Struts2,成为了主流的MVC框架。同样,Spring Cloud也是如此,Spring Cloud的核心并没有实现任何上述功能,让我们来看看Spring Cloud官方文档的一段介绍。

  Many of those features are covered by Spring Boot, on which Spring Cloud builds. Some more features are delivered by Spring Cloud as two libraries: Spring Cloud Context and Spring Cloud Commons. Spring Cloud Context provides utilities and special services for the ApplicationContext of a Spring Cloud application (bootstrap context, encryption, refresh scope, and environment endpoints). Spring Cloud Commons is a set of abstractions and common classes used in different Spring Cloud implementations (such as Spring Cloud Netflix and Spring Cloud Consul).

  翻译:

  这些功能(就是上面列举的功能)大部分是由Spring Boot覆盖的,而Spring Cloud基于Spring Boot构建。Spring Cloud作为两个libraries提供了更多的功能。这两个libraries分别是,Spring Cloud Context和Spring Cloud Commons。其中Spring Cloud Context提供了一些工具,以及一个Spring Cloud应用的ApplicationContext的特殊服务,比如bootstrap上下文(关于这个家伙,后面有机会笔者会详细介绍)、加密、刷新、环境端点这些功能。而Spring Cloud Commons则是一组抽象和在不同Spring Cloud实现(比如Spring Cloud Netflix和Spring Cloud Consul)中使用的通用类。

  可以看出,Spring Cloud其实是一套规范,而不是一个可以拿来即用的框架,而Spring Cloud Netflix以及Spring Cloud Consul,才是Spring Cloud规范的实现。当然了,Spring Cloud的实现又多了一种,Spring Cloud Alibaba,-_-

Spring Cloud Alibaba和Spring Cloud的关系,Spring Cloud Alibaba(以下简称SCA)和Spring Cloud Netflix(以下简称SCN)一样,都是Spring Cloud规范的一套实现。

Spring Cloud使用最广的就是Spring Cloud Netflix,不过在2018-12-12日,Netflix宣布Spring Cloud Netflix系列技术栈进入维护模式(不再添加新特性),距离上次宣布Eureka 2.0闭源(Spring Cloud 还是在1.x 上面开发的,最新版本依赖1.9.2)不到半年的光景。链接:Spring Cloud Netflix Projects Entering Maintenance Mode 官方新闻

SCN 的未来基本上是凉凉了,但是SCA中的组件,基本都是由阿里内部中间件转化而来,经历过多次双十一的考验,这也就意味着,SCA有着充足的场景,验证了它对于高并发的抗压能力。Ali此次入驻Spring Cloud “取代” Spring Cloud Netflix的“居心”路人皆知,Netflix的一套高可用服务,出版的Spring Cloud Alibaba 基本都有。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值