站点工具


服务器技术:微服务: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
行 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;">​数据访问层,如果单表数据量过大则需要通过
服务器技术/微服务/dubbo和spring_cloud微服务架构对比.1535514574.txt.gz · 最后更改: 2018/09/10 18:01 (外部编辑)