Spring Cloud and Dubbo, in the end with what is good? I chose Spring Cloud

Spring Cloud is http transmission protocol, the bandwidth will be more while using the http protocol typically use JSON messages, consumption will be greater

dubbo of development more difficult, because the jar package dependencies dubbo many large projects can not be solved

springcloud interface agreement relatively free and loose, requires strong administrative measures to restrict the interface disorderly upgrade

dubbo registries can choose a variety zk, redis, etc., springcloud the registry can only be used eureka or self-study

But if I choose, I will use Spring Cloud.

Company overall plan: I would not choose long unmaintained dubbo, then restart it may not be the same team

The total degree of difficulty recruiting programmers : springcloud recruit programmers will be better recruit, because fancier update

Summary of the system architecture: the system structure is simpler springcloud, "registration + springmvc = springcloud", and the complex Dubbo Url, protocol, register, invocation, dubbofilter, dubboSPI, dubbo serialization ........ .. virtuoso composition of some more

From a performance: Dubbo network consumes less than springcloud, but in 95% of the domestic companies, network overhead is not a big problem, if it became a problem, through compression, binary, cache, segmentation demotion and other methods, it is easy to solution

From the development of difficulty: Dubbo God pit is dependent jar package, the development stage is extremely difficult, I once took a team of thirty people, because the jar package upgrade issues, to everyone's computers are operated, especially everybody computer library path, commands, shortcuts, keyboard, mouse speed is not the same, I had never been seen silently in the hearts of the dubbo Lv inventor whole family one hundred and twenty times.

springcloud more freedom, but the problem is not caused by "strong constraint Interface Specification," suggesting solved by administrative means, and we have a strong team of administrative constraints do still better, more powerful interface control level, with no administrative organization the ability of the IT team is really a waste, what is not so that frame.

From the subsequent improvement: Dubbo improvement is through dubbofilter, a lot of things do not need their own inheritance, such as monitoring, such as logs, unlimited stream, such as tracking. springcloud himself with a lot of monitoring, limiting measures, but European and American habits and may function the same, the need for appropriate domestic reform, but more simple, that is ServletFilter it, but it is always better than something more than dubbo

From supporting measures: springcloud has always claimed that he is "a set all aspects of the solution." . . . . . I initially believed, but later found fooled, to be honest: Yes, but not very sound, 100 points playing like 50, you still need a lot of renovation.

And contrary DUBBO, has been claimed to be " a full-service aspects of the scheme ." . . . . .

Pure service of the top bird with any supporting systems are complementary, a complete system, have a front, middle, back, front including front-end and interactive, including trading in Taiwan, tasks, data, including financial background, account management ........... purely as a service can not solve "any problem", the only system to resolve.

At this level, springcloud toward a "system" of development programs, and dubbo only a tool only, compared to the difference between the two is like than Archeopteryx and paramecium.

From the technical strength levels: the contrast between the two sides source, authors have to say dubbo technical capabilities than springCloud, and the author of the technical capacity springBoot than dubbo.

Namely: springboot> dubbo> springcloud. I like springboot this Road to Jane style, keep it simple and stupid.

而dubbo好嘛......你先看看dubboSPI,再看看Protocol$Adpative里面那一群绕来绕去的瞎几把绕的玩意儿,你会迅速判断出:这群屌丝在炫技。

尽管dubbo从上之下分为十层四五十个组件,第一感官上是哇塞好全面好伟大的样子,但深入之后你会觉得,这技术是很炫,设计的确实很全面,但是用不到,例如:请各位大神给我解释一下,在zookeeper地址中,使用逗号分隔和分号分隔地址的区别。。。。。

用途不大,但是代码里为了这个就走向了“完全不同”的一条分支。用俗语评价,就是“臃肿且无用代码过多,在文档里还非得为了这个说出123456来”。

说完dubbo再说springCloud........它没有技术含量,完全没有,就是一堆简单组件拼装在一起,如configserver、eurekaserver、robin、feignClient、htstrix等,每个都特别简单,没什么技术含量,但我喜欢这种的,就喜欢这种大道至简的简单。

最后说springBoot,我要用“纯粹”两个字来评价这个框架,真的很纯粹,并且从其代码架构的总体思路一致性,目标的纯粹性,具体模块的干净利落,确实是个好框架,值得大家一读。

从系统应用层面:在技术实力满分一百能打85分的鄙人的眼中,dubbo和springcloud,不就是两个框架么?我们是要拯救世界的人,这俩块鹅卵石一块圆的一块方的,能垫脚就行,没有区别。

简而言之,Dubbo确实类似于Spring Cloud的一个子集,Dubbo功能和文档完善,在国内有很多的成熟用户,然而鉴于Dubbo的社区现状(曾经长期停止维护,2017年7月31日团队又宣布重点维护),使用起来还是有一定的门槛。

Dubbo具有调度、发现、监控、治理等功能,支持相当丰富的服务治理能力。Dubbo架构下,注册中心对等集群,并会缓存服务列表已被数据库失效时继续提供发现功能,本身的服务发现结构有很强的可用性与健壮性,足够支持高访问量的网站。

55de3064e2c847fea439ceba1f79b68c


2f2d30683eac496c9dbf45266e3ef2b4


虽然Dubbo 支持短连接大数据量的服务提供模式,但绝大多数情况下都是使用长连接小数据量的模式提供服务使用的。

所以,对于类似于电商等同步调用场景多并且能支撑搭建Dubbo 这套比较复杂环境的成本的产品而言,Dubbo 确实是一个可以考虑的选择。

但如果产品业务中由于后台业务逻辑复杂、时间长而导致异步逻辑比较多的话,可能Dubbo 并不合适。同时,对于人手不足的初创产品而言,这么重的架构维护起来也不是很方便。

Spring Cloud由众多子项目组成,如Spring Cloud Config、Spring Cloud Netflix、Spring Cloud Consul 等,提供了搭建分布式系统及微服务常用的工具,如配置管理、服务发现、断路器、智能路由、微代理、控制总线、一次性token、全局锁、选主、分布式会话和集群状态等,满足了构建微服务所需的所有解决方案。

比如使用Spring Cloud Config 可以实现统一配置中心,对配置进行统一管理;使用Spring Cloud Netflix 可以实现Netflix 组件的功能 - 服务发现(Eureka)、智能路由(Zuul)、客户端负载均衡(Ribbon)。

但它并没有重复造轮子,而是选用目前各家公司开发的比较成熟的、经得住实践考验的服务框架(我们需要特别感谢Netflix ,这家很早就成功实践微服务的公司,几年前把自家几乎整个微服务框架栈贡献给了社区,Spring Cloud主要是对Netflix开源组件的进一步封装),通过Spring Boot 进行封装集成并简化其使用方式。

基于Spring Boot,意味着其使用方式如Spring Boot 简单易用;能够与Spring Framework、Spring Boot、Spring Data 等其他Spring 项目完美融合,意味着能从Spring获得巨大的便利,意味着能减少已有项目的迁移成本。

其实,从社区活跃度和功能完整度,再对照业务需求和团队状况,基本可以确定如何选型。这里分享网易考拉海购实践以及团队选型的心声:

当前开源上可选用的微服务框架主要有Dubbo、Spring Cloud等,鉴于Dubbo完备的功能和文档且在国内被众多大型互联网公司选用,考拉自然也选择了Dubbo作为服务化的基础框架。

其实相比于Dubbo,Spring Cloud可以说是一个更完备的微服务解决方案,它从功能性上是Dubbo的一个超集,个人认为从选型上对于一些中小型企业Spring Cloud可能是一个更好的选择。

提起Spring Cloud,一些开发的第一印象是http+JSON的rest通信,性能上难堪重用,其实这也是一种误读。

微服务选型要评估以下几点:内部是否存在异构系统集成的问题;备选框架功能特性是否满足需求;http协议的通信对于应用的负载量会否真正成为瓶颈点(Spring Cloud也并不是和http+JSON强制绑定的,如有必要Thrift、protobuf等高效的RPC、序列化协议同样可以作为替代方案);社区活跃度、团队技术储备等。

作为已经没有团队持续维护的开源项目,选择Dubbo框架内部就必须要组建一个维护团队,先不论你要准备要集成多少功能做多少改造,作为一个支撑所有工程正常运转的基础组件,问题的及时响应与解答、重大缺陷的及时修复能力就已足够重要。

鉴于服务发现对服务化架构的重要性,再补充一点:Dubbo 实践通常以ZooKeeper 为注册中心(Dubbo 原生支持的Redis 方案需要服务器时间同步,且性能消耗过大)。

针对分布式领域著名的CAP理论(C——数据一致性,A——服务可用性,P——服务对网络分区故障的容错性),Zookeeper 保证的是CP ,但对于服务发现而言,可用性比数据一致性更加重要 ,而 Eureka 设计则遵循AP原则 。

为什么选择使用Spring Cloud而放弃了Dubbo?

可能大家会问,为什么选择了使用Dubbo之后,而又选择全面使用Spring Cloud呢?其中有几个原因:

1)从两个公司的背景来谈:Dubbo,是阿里巴巴服务化治理的核心框架,并被广泛应用于中国各互联网公司;Spring Cloud是大名鼎鼎的Spring家族的产品。

阿里巴巴是一个商业公司,虽然也开源了很多的顶级的项目,但从整体战略上来讲,仍然是服务于自身的业务为主。Spring专注于企业级开源框架的研发,不论是在中国还是在世界上使用都非常广泛,开发出通用、开源、稳健的开源框架就是他们的主业。

2)从社区活跃度这个角度来对比,Dubbo虽然也是一个非常优秀的服务治理框架,并且在服务治理、灰度发布、流量分发这方面做的比Spring Cloud还好,除过当当网在基础上增加了rest支持外,已有两年多的时间几乎都没有任何更新了。在使用过程中出现问题,提交到github的Issue也少有回复。

相反Spring Cloud自从发展到现在,仍然在不断的高速发展,从github上提交代码的频度和发布版本的时间间隔就可以看出,现在Spring Cloud即将发布2.0版本,到了后期会更加完善和稳定。

3) 从整个大的平台架构来讲,dubbo框架只是专注于服务之间的治理,如果我们需要使用配置中心、分布式跟踪这些内容都需要自己去集成,这样无形中使用dubbo的难度就会增加。Spring Cloud几乎考虑了服务治理的方方面面,更有Spring Boot这个大将的支持,开发起来非常的便利和简单。

4)从技术发展的角度来讲,Dubbo刚出来的那会技术理念还是非常先进,解决了各大互联网公司服务治理的问题,中国的各中小公司也从中受益不少。

经过了这么多年的发展,互联网行业也是涌现了更多先进的技术和理念,Dubbo一直停滞不前,自然有些掉队,有时候我个人也会感到有点可惜,如果Dubbo一直沿着当初的那个路线发展,并且延伸到周边,今天可能又是另一番景象了。

Spring 推出Spring Boot/Cloud也是因为自身的很多原因。Spring最初推崇的轻量级框架,随着不断的发展也越来越庞大,随着集成项目越来越多,配置文件也越来越混乱,慢慢的背离最初的理念。

随着这么多年的发展,微服务、分布式链路跟踪等更多新的技术理念的出现,Spring急需一款框架来改善以前的开发模式,因此才会出现Spring Boot/Cloud项目,我们现在访问Spring官网,会发现Spring Boot和Spring Cloud已经放到首页最重点突出的三个项目中的前两个,可见Spring对这两个框架的重视程度。

总结一下,dubbo曾经确实很牛逼,但是Spring Cloud是站在近些年技术发展之上进行开发,因此更具技术代表性。

spring cloud整机,dubbo需要自己组装;整机的性能有保证,组装的机子更自由。

最后,分享一份【Spring Cloud实战】文档资料,转发+关注 然后加入我的个人粉丝群(Java架构技术栈:644872653)即可获得免费领取方式!


Guess you like

Origin blog.51cto.com/14480698/2472755