站点工具


服务器技术:微服务:dubbo和spring_cloud微服务架构对比

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

后一修订版
前一修订版
服务器技术:微服务:dubbo和spring_cloud微服务架构对比 [2018/08/29 11:49]
admin 创建
服务器技术:微服务:dubbo和spring_cloud微服务架构对比 [2018/09/10 18:02] (当前版本)
行 1: 行 1:
-<h2 class="​rich_media_title"​ style="​font-weight:​400;​font-size:​24px;​line-height:​1.4;​font-family:&#​39;​Hiragino Sans GB&#​39;,​ &#​39;​Microsoft YaHei&#​39;,​ Arial, sans-serif;">​Dubbo和Spring Cloud微服务架构对比</​h2><​p>​原文:https://​blog.csdn.net/​zhangweiwei2020/​article/​details/​78646252</​p><​p><​br/><​br/><​span style="​color:​rgb(89,​89,​89);​font-family:&#​39;​Hiragino Sans GB&#​39;,​ &#​39;​Microsoft YaHei&#​39;,​ Arial, sans-serif;​font-size:​15px;​letter-spacing:​1px;​background-color:​rgb(239,​239,​239);">​微服务架构是互联网很热门的话题,是互联网技术发展的必然结果。它提倡将单一应用程序划分成一组小的服务,服务之间互相协调、互相配合,为用户提供最终价值。</​span><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​虽然微服务架构没有公认的技术标准和规范或者草案,但业界已经有一些很有影响力的开源微服务架构框架提供了微服务的关键思路,例如 Dubbo 和 Spring Cloud。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​各大互联网公司也有自研的微服务框架,但其模式都与这二者相差不大。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;">​微服务主要的优势</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​降低复杂度</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​将原来耦合在一起的复杂业务拆分为单个服务,规避了原本复杂度无止境的积累。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​每一个微服务专注于单一功能,并通过定义良好的接口清晰表述服务边界;每个服务开发者只专注服务本身,通过使用缓存、DAL 等各种技术手段来提升系统的性能,而对于消费方来说完全透明。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​可独立部署</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由于微服务具备独立的运行进程,所以每个微服务可以独立部署。当业务迭代时只需要发布相关服务的迭代即可,降低了测试的工作量同时也降低了服务发布的风险。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​容错</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​在微服务架构下,当某一组件发生故障时,故障会被隔离在单个服务中。比如通过限流、熔断等方式降低错误导致的危害,保障核心业务正常运行。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​扩展</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​单块架构应用也可以实现横向扩展,就是将整个应用完整的复制到不同的节点。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​当应用的不同组件在扩展需求上存在差异时,微服务架构便体现出其灵活性,因为每个服务可以根据实际需求独立进行扩展。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​本文主要围绕微服务的技术选型、通讯协议、服务依赖模式、开始模式、运行模式等几方面来综合比较 Dubbo 和 Spring Cloud 这 2 种开发框架。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​架构师可以根据公司的技术实力并结合项目的特点来选择某个合适的微服务架构平台,以此稳妥地实施项目的微服务化改造或开发进程。</​span></​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​核心部件</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​微服务的核心要素在于服务的发现、注册、路由、熔断、降级、分布式配置,基于上述几种必要条件对 Dubbo 和 Spring Cloud 做出对比。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h3><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​总体架构</​p><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h3><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Dubbo 核心部件(如下图):</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Provider:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​暴露服务的提供方,可以通过+<h2 class="​rich_media_title"​ style="​font-weight:​400;​font-size:​24px;​line-height:​1.4;">​Dubbo和Spring Cloud微服务架构对比</​h2><​p>​原文:https://​blog.csdn.net/​zhangweiwei2020/​article/​details/​78646252</​p><​p><​br/><​br/><​span style="​color:​rgb(89,​89,​89);​font-family:&#​39;​Hiragino Sans GB&#​39;,​ &#​39;​Microsoft YaHei&#​39;,​ Arial, sans-serif;​font-size:​15px;​letter-spacing:​1px;​background-color:​rgb(239,​239,​239);">​微服务架构是互联网很热门的话题,是互联网技术发展的必然结果。它提倡将单一应用程序划分成一组小的服务,服务之间互相协调、互相配合,为用户提供最终价值。</​span><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​虽然微服务架构没有公认的技术标准和规范或者草案,但业界已经有一些很有影响力的开源微服务架构框架提供了微服务的关键思路,例如 Dubbo 和 Spring Cloud。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​各大互联网公司也有自研的微服务框架,但其模式都与这二者相差不大。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;">​微服务主要的优势</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​降低复杂度</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​将原来耦合在一起的复杂业务拆分为单个服务,规避了原本复杂度无止境的积累。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​每一个微服务专注于单一功能,并通过定义良好的接口清晰表述服务边界;每个服务开发者只专注服务本身,通过使用缓存、DAL 等各种技术手段来提升系统的性能,而对于消费方来说完全透明。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​可独立部署</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由于微服务具备独立的运行进程,所以每个微服务可以独立部署。当业务迭代时只需要发布相关服务的迭代即可,降低了测试的工作量同时也降低了服务发布的风险。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​容错</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​在微服务架构下,当某一组件发生故障时,故障会被隔离在单个服务中。比如通过限流、熔断等方式降低错误导致的危害,保障核心业务正常运行。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​扩展</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​单块架构应用也可以实现横向扩展,就是将整个应用完整的复制到不同的节点。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​当应用的不同组件在扩展需求上存在差异时,微服务架构便体现出其灵活性,因为每个服务可以根据实际需求独立进行扩展。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​本文主要围绕微服务的技术选型、通讯协议、服务依赖模式、开始模式、运行模式等几方面来综合比较 Dubbo 和 Spring Cloud 这 2 种开发框架。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​架构师可以根据公司的技术实力并结合项目的特点来选择某个合适的微服务架构平台,以此稳妥地实施项目的微服务化改造或开发进程。</​span></​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​核心部件</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​微服务的核心要素在于服务的发现、注册、路由、熔断、降级、分布式配置,基于上述几种必要条件对 Dubbo 和 Spring Cloud 做出对比。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h3><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​总体架构</​p><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h3><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Dubbo 核心部件(如下图):</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Provider:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​暴露服务的提供方,可以通过
  jar 或者容器的方式启动服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Consumer:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​调用远程服务的服务消费方。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Registry:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务注册中心和发现中心。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Monitor:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​统计服务和调用次数,调用时间监控中心。(Dubbo  jar 或者容器的方式启动服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Consumer:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​调用远程服务的服务消费方。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Registry:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务注册中心和发现中心。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Monitor:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​统计服务和调用次数,调用时间监控中心。(Dubbo
  ​的控制台页面中可以显示,目前只有一个简单版本。)</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Container:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务运行的容器。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​img src="​https://​img-blog.csdn.net/​20171127161905651"​ alt=""/><​br/><​span style="​font-size:​14px;"><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo  ​的控制台页面中可以显示,目前只有一个简单版本。)</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Container:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务运行的容器。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​img src="​https://​img-blog.csdn.net/​20171127161905651"​ alt=""/><​br/><​span style="​font-size:​14px;"><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo
行 7: 行 7:
  ​Hydra,或者扩展 Filter 用 Zippin 来做服务跟踪。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​批量任务:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​可以使用当当开源的  ​Hydra,或者扩展 Filter 用 Zippin 来做服务跟踪。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​批量任务:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​可以使用当当开源的
  ​Elastic-Job、tbschedule。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​line-height:​1.75em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​点评:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​从核心要素来看,Spring  ​Elastic-Job、tbschedule。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​line-height:​1.75em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​点评:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​从核心要素来看,Spring
- Cloud 更胜一筹,在开发过程中只要整合 Spring Cloud 的子项目就可以顺利的完成各种组件的融合,而 Dubbo 却需要通过实现各种 Filter 来做定制,开发成本以及技术难度略高。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​通讯协议</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​基于通讯协议层面对 2 种框架支持的协议类型以及运行效率方面进行比较。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h3><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​支持协议</​p><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"​><​a></​a><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo</​span></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"><​br/></​span></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"​><​a></​a><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Dubbo 使用 RPC 通讯协议,提供序列化方式如下:</​span></​h3><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo+ Cloud 更胜一筹,在开发过程中只要整合 Spring Cloud 的子项目就可以顺利的完成各种组件的融合,而 Dubbo 却需要通过实现各种 Filter 来做定制,开发成本以及技术难度略高。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​通讯协议</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​基于通讯协议层面对 2 种框架支持的协议类型以及运行效率方面进行比较。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h3><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​支持协议</​p><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo</​span></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"><​br/></​span></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Dubbo 使用 RPC 通讯协议,提供序列化方式如下:</​span></​h3><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo
  ​缺省协议采用单一长连接和 NIO 异步通讯,适合于小数据量大并发的服务调用,以及服务消费者机器数远大于服务提供者机器数的情况。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​RMI:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​RMI  ​缺省协议采用单一长连接和 NIO 异步通讯,适合于小数据量大并发的服务调用,以及服务消费者机器数远大于服务提供者机器数的情况。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​RMI:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​RMI
  ​协议采用 JDK 标准的 java.rmi.* 实现,采用阻塞式短连接和 JDK 标准序列化方式。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Hessian:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Hessian  ​协议采用 JDK 标准的 java.rmi.* 实现,采用阻塞式短连接和 JDK 标准序列化方式。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Hessian:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Hessian
行 23: 行 23:
  ​通过 Dubbo 提供的负载均衡机制自动完成。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Service:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务,只提供该业务相关的原子服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Zookeeper:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务注册到  ​通过 Dubbo 提供的负载均衡机制自动完成。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Service:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务,只提供该业务相关的原子服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Zookeeper:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务注册到
  ZK 上。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​img src="​https://​img-blog.csdn.net/​20171127162048355"​ alt=""/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​span style="​font-size:​14px;"><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring  ZK 上。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​img src="​https://​img-blog.csdn.net/​20171127162048355"​ alt=""/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​span style="​font-size:​14px;"><​span style="​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring
- Cloud 组件运行</​span></​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​Spring Cloud</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Spring Cloud组件运行:</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​所有请求都统一通过 API 网关(Zuul)来访问内部服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​网关接收到请求后,从注册中心(Eureka)获取可用服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由 Ribbon 进行均衡负载后,分发到后端的具体实例。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​微服务之间通过 Feign 进行通信处理业务。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​line-height:​1.75em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​点评:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​业务部署方式相同,都需要前置一个网关来隔绝外部直接调用原子服务的风险。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 需要自己开发一套 API 网关,而 Spring Cloud 则可以通过 Zuul 配置即可完成网关定制。使用方式上 Spring Cloud 略胜一筹。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​微服务架构组成以及注意事项</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​到底使用是 Dubbo 还是 Spring Cloud 并不重要,重点在于如何合理的利用微服务。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​下面是一张互联网通用的架构图,其中每个环节都是微服务的核心部分。</​span></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​img src="​https://​img-blog.csdn.net/​20171127162056684"​ alt=""/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​架构分解:</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​网关集群:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据的聚合、实现对接入客户端的身份认证、防报文重放与防数据篡改、功能调用的业务鉴权、响应数据的脱敏、流量与并发控制等。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​业务集群:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​一般情况下移动端访问和浏览器访问的网关需要隔离,防止业务耦合。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Local Cache:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由于客户端访问业务可能需要调用多个服务聚合,所以本地缓存有效的降低了服务调用的频次,同时也提示了访问速度。本地缓存一般使用自动过期方式,业务场景中允许有一定的数据延时。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务层:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务层,实现基础的增删改查功能,如果需要依赖其他服务需要在+ Cloud 组件运行</​span></​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p><​p><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span><​span style="​display:​block;​background-color:​rgb(89,​89,​89);"></​span></​p><​p style="​clear:​both;​min-height:​1em;">​Spring Cloud</​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​Spring Cloud组件运行:</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​所有请求都统一通过 API 网关(Zuul)来访问内部服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​网关接收到请求后,从注册中心(Eureka)获取可用服务。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由 Ribbon 进行均衡负载后,分发到后端的具体实例。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​微服务之间通过 Feign 进行通信处理业务。</​span></​p></​li></​ul><​p style="​clear:​both;​min-height:​1em;​line-height:​1.75em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​点评:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​业务部署方式相同,都需要前置一个网关来隔绝外部直接调用原子服务的风险。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 需要自己开发一套 API 网关,而 Spring Cloud 则可以通过 Zuul 配置即可完成网关定制。使用方式上 Spring Cloud 略胜一筹。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​微服务架构组成以及注意事项</​p><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​2em;"><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​到底使用是 Dubbo 还是 Spring Cloud 并不重要,重点在于如何合理的利用微服务。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​下面是一张互联网通用的架构图,其中每个环节都是微服务的核心部分。</​span></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​center;​line-height:​2em;"><​br/></​p><​p style="​clear:​ both; min-height: 1em; line-height:​ 2em;"><img src="/​dokuwiki/​ueditor/​php/​upload/​image/​20180829/​1535521816343820.png"​ title="​1535521816343820.png"​ alt="​图片.png"/​><img src="​https://​img-blog.csdn.net/​20171127162056684"​ alt=""/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​架构分解:</​span></​p><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​网关集群:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据的聚合、实现对接入客户端的身份认证、防报文重放与防数据篡改、功能调用的业务鉴权、响应数据的脱敏、流量与并发控制等。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​业务集群:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​一般情况下移动端访问和浏览器访问的网关需要隔离,防止业务耦合。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Local Cache:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​由于客户端访问业务可能需要调用多个服务聚合,所以本地缓存有效的降低了服务调用的频次,同时也提示了访问速度。本地缓存一般使用自动过期方式,业务场景中允许有一定的数据延时。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务层:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​原子服务层,实现基础的增删改查功能,如果需要依赖其他服务需要在
  ​Service 层主动调用。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Remote Cache:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​访问  ​Service 层主动调用。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Remote Cache:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​访问
  DB 前置一层分布式缓存,减少 DB 交互次数,提升系统的TPS。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​DAL:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据访问层,如果单表数据量过大则需要通过  DB 前置一层分布式缓存,减少 DB 交互次数,提升系统的TPS。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​DAL:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据访问层,如果单表数据量过大则需要通过
  DAL 层做数据的分库分表处理。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​MQ:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​消息队列用来解耦服务之间的依赖,异步调用可以通过  DAL 层做数据的分库分表处理。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​MQ:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​消息队列用来解耦服务之间的依赖,异步调用可以通过
  MQ 的方式来执行。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据库主从:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务化过程中必经的阶段,用来提升系统的  MQ 的方式来执行。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​数据库主从:</​span><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务化过程中必经的阶段,用来提升系统的
- ​TPS。</​span></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p></​li></​ul><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​1.75em;"><​br/></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"​><​a></​a><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​注意事项:</​span></​h3><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务启动方式建议使用jar方式启动,启动速度快,更容易监控。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​缓存、缓存、缓存,系统中能使用缓存的地方尽量使用缓存,通过合理的使用缓存可以有效的提高系统的TPS。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务拆分要合理,尽量避免因服务拆分而导致的服务循环依赖。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​合理的设置线程池,避免设置过大或者过小导致系统异常。</​span></​p></​li></​ul><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​1.75em;"><​br/></​h2><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​总结</​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 出生于阿里系,是阿里巴巴服务化治理的核心框架,并被广泛应用于中国各互联网公司;只需要通过 Spring 配置的方式即可完成服务化,对于应用无入侵,</​span><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​设计的目的还是服务于自身的业务为主。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​虽然阿里内部原因 Dubbo 曾经一度暂停维护版本,但是框架本身的成熟度以及文档的完善程度,完全能满足各大互联网公司的业务需求。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​如果我们使用配置中心、分布式跟踪这些内容都需要自己去集成,这样无形中增加了使用 Dubbo 的难度。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring Cloud 是大名鼎鼎的 Spring 家族的产品, 专注于企业级开源框架的研发。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring Cloud 自从发布到现在,仍然在不断的高速发展,几乎考虑了服务治理的方方面面,开发起来非常的便利和简单。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 于 2017 年开始又重启维护,发布了更新后的 2.5.7 版本,而 Spring Cloud 更新的非常快,目前已经更新到 Finchley.M2。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​因此,企业需要根据自身的研发水平和所处阶段选择合适的架构来解决业务问题,不管是 Dubbo 还是 Spring Cloud 都是实现微服务有效的工具。</​span></​p><​p><​span style="​color:​rgb(89,​89,​89);​font-family:&#​39;​Hiragino Sans GB&#​39;,​ &#​39;​Microsoft YaHei&#​39;,​ Arial, sans-serif;​font-size:​15px;​letter-spacing:​1px;​background-color:​rgb(239,​239,​239);">​微服务架构是互联网很热门的话题,是互联网技术发展的必然结果。它提倡将单一应用程序划分成一组小的服务,服务之间互相协调、互相配合,为用户提供最终价值</​span></​p><​p><​br/></​p>​+ ​TPS。</​span></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​p></​li></​ul><​h3 style="​font-weight:​400;​font-size:​16px;​line-height:​1.75em;"><​br/></​h3><​h3 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​letter-spacing:​1px;​color:​rgb(71,​193,​168);">​注意事项:</​span></​h3><​ul class="​ list-paddingleft-2"><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务启动方式建议使用jar方式启动,启动速度快,更容易监控。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​缓存、缓存、缓存,系统中能使用缓存的地方尽量使用缓存,通过合理的使用缓存可以有效的提高系统的TPS。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​服务拆分要合理,尽量避免因服务拆分而导致的服务循环依赖。</​span></​p></​li><​li><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​合理的设置线程池,避免设置过大或者过小导致系统异常。</​span></​p></​li></​ul><​h2 style="​font-weight:​400;​font-size:​16px;​line-height:​1.75em;"><​br/></​h2><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span></​h2><​p style="​clear:​both;​min-height:​1em;">​总结</​p><​h2 style="​font-weight:​400;​font-size:​16px;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;"></​span><​br/></​h2><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 出生于阿里系,是阿里巴巴服务化治理的核心框架,并被广泛应用于中国各互联网公司;只需要通过 Spring 配置的方式即可完成服务化,对于应用无入侵,</​span><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​设计的目的还是服务于自身的业务为主。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​虽然阿里内部原因 Dubbo 曾经一度暂停维护版本,但是框架本身的成熟度以及文档的完善程度,完全能满足各大互联网公司的业务需求。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​color:​rgb(89,​89,​89);​font-size:​15px;​letter-spacing:​1px;​line-height:​2em;">​如果我们使用配置中心、分布式跟踪这些内容都需要自己去集成,这样无形中增加了使用 Dubbo 的难度。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring Cloud 是大名鼎鼎的 Spring 家族的产品, 专注于企业级开源框架的研发。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Spring Cloud 自从发布到现在,仍然在不断的高速发展,几乎考虑了服务治理的方方面面,开发起来非常的便利和简单。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​Dubbo 于 2017 年开始又重启维护,发布了更新后的 2.5.7 版本,而 Spring Cloud 更新的非常快,目前已经更新到 Finchley.M2。</​span></​p><​p style="​clear:​both;​min-height:​1em;​line-height:​2em;"><​br/></​p><​p style="​clear:​both;​min-height:​1em;​text-align:​justify;​line-height:​2em;"><​span style="​font-size:​15px;​color:​rgb(89,​89,​89);​letter-spacing:​1px;">​因此,企业需要根据自身的研发水平和所处阶段选择合适的架构来解决业务问题,不管是 Dubbo 还是 Spring Cloud 都是实现微服务有效的工具。</​span></​p><​p><​span style="​color:​rgb(89,​89,​89);​font-family:&#​39;​Hiragino Sans GB&#​39;,​ &#​39;​Microsoft YaHei&#​39;,​ Arial, sans-serif;​font-size:​15px;​letter-spacing:​1px;​background-color:​rgb(239,​239,​239);">​微服务架构是互联网很热门的话题,是互联网技术发展的必然结果。它提倡将单一应用程序划分成一组小的服务,服务之间互相协调、互相配合,为用户提供最终价值</​span></​p><​p><​br/></​p>​
服务器技术/微服务/dubbo和spring_cloud微服务架构对比.1535514544.txt.gz · 最后更改: 2018/09/10 18:01 (外部编辑)