• 欢迎访问速搜资源吧,如果在网站上找不到你需要的资源,可以在留言板上留言,管理员会尽量满足你!

【速搜问答】Dubbo是什么

问答 admin 3年前 (2020-07-13) 530次浏览 已收录 0个评论

汉英对照:
Chinese-English Translation:

Apache Dubbo是一款高性能、轻量级的开源Java RPC框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。Dubbo于2018年被阿里巴巴捐赠给Apache基金会。

Apache Dubbo is a high-performance, lightweight open source Java RPC framework. It provides three core capabilities: interface oriented remote method call, intelligent fault tolerance and load balancing, and automatic service registration and discovery. Dubbo was donated to the Apache foundation by Alibaba in 2018.

Apache Dubbo 是一款高性能、轻量级的开源 Java RPC 框架,它提供了三大核心能力:面向接口的远程方法调用,智能容错和负载均衡,以及服务自动注册和发现。Dubbo 原属于阿里巴巴的开源项目,2018 年阿里巴巴捐赠给 Apache 基金会。

Apache Dubbo is a high-performance, lightweight open source Java RPC framework. It provides three core capabilities: interface oriented remote method call, intelligent fault tolerance and load balancing, and automatic service registration and discovery. Dubbo was originally an open source project of Alibaba. In 2018, Alibaba donated it to the Apache foundation.

Dubbo 采用全 Spring 配置方式,透明化接入应用,对应用没有任何 API 侵入,只需用 Spring 加载 Dubbo 的配置即可,Dubbo 基于 Spring 的 Schema 扩展 进行加载。

Dubbo uses the full spring configuration mode to access the application transparently. There is no API intrusion to the application. You only need spring to load Dubbo’s configuration. Dubbo is loaded based on the Schema Extension of spring.

背景

background

随着互联网的发展,网站应用的规模不断扩大,常规的垂直应用架构已无法应对,分布式服务架构以及流动计算架构势在必行,亟需一个治理系统确保架构有条不紊的演进。

With the development of the Internet, the scale of website application is constantly expanding, and the conventional vertical application architecture can not cope with it. The distributed service architecture and mobile computing architecture are imperative. A governance system is needed to ensure the orderly evolution of the architecture.

单一应用架构

Single application architecture

当网站流量很小时,只需一个应用,将所有功能都部署在一起,以减少部署节点和成本。此时,用于简化增删改查工作量的数据访问框架(ORM)是关键。

When the website traffic is very small, only one application is needed to deploy all functions together to reduce deployment nodes and costs. At this time, the data access framework (ORM) is the key to simplify the workload of adding, deleting, modifying and querying.

垂直应用架构

Vertical application architecture

当访问量逐渐增大,单一应用增加机器带来的加速度越来越小,提升效率的方法之一是将应用拆成互不相干的几个应用,以提升效率。此时,用于加速前端页面开发的 Web 框架(MVC)是关键。

When the number of visits increases gradually, the acceleration brought by the increase of single application becomes smaller and smaller. One of the ways to improve efficiency is to split the application into several unrelated applications to improve efficiency. At this point, the web framework (MVC) for accelerating the development of front-end pages is the key.

分布式服务架构

Distributed service architecture

当垂直应用越来越多,应用之间交互不可避免,将核心业务抽取出来,作为独立的服务,逐渐形成稳定的服务中心,使前端应用能更快速的响应多变的市场需求。此时,用于提高业务复用及整合的分布式服务框架(RPC)是关键。

With more and more vertical applications, the interaction between applications is inevitable. The core business is extracted as an independent service to gradually form a stable service center, so that the front-end application can respond to the changing market demand more quickly. At this time, the distributed service framework (RPC) is the key to improve business reuse and integration.

流动计算架构

Flow computing architecture

当服务越来越多,容量的评估,小服务资源的浪费等问题逐渐显现,此时需增加一个调度中心基于访问压力实时管理集群容量,提高集群利用率。此时,用于提高机器利用率的资源调度和治理中心(SOA)是关键。

When there are more and more services, the evaluation of capacity, the waste of small service resources and other problems gradually appear. At this time, it is necessary to add a scheduling center to manage the cluster capacity in real time based on the access pressure to improve the cluster utilization. At this time, resource scheduling and Governance Center (SOA) is the key to improve machine utilization.

需求

demand

在大规模服务化之前,应用可能只是通过 RMI 或 Hessian 等工具,简单的暴露和引用远程服务,通过配置服务的 URL 地址进行调用,通过 F5 等硬件进行负载均衡。

Before large-scale service, the application may simply expose and reference remote services through RMI or Hessian tools, call by configuring the URL address of the service, and load balancing through hardware such as F5.

当服务越来越多时,服务 URL 配置管理变得非常困难,F5 硬件负载均衡器的单点压力也越来越大。 此时需要一个服务注册中心,动态地注册和发现服务,使服务的位置透明。并通过在消费方获取服务提供方地址列表,实现软负载均衡和 Failover,降低对 F5 硬件负载均衡器的依赖,也能减少部分成本。

When there are more and more services, the configuration management of service URL becomes very difficult, and the single point pressure of F5 hardware load balancer is also increasing. At this time, a service registry is needed to register and discover services dynamically to make the location of services transparent. By obtaining the address list of service providers in the consumer side, the software load balancing and failure can be realized, and the dependence on F5 hardware load balancer can be reduced, and part of the cost can also be reduced.

当进一步发展,服务间依赖关系变得错踪复杂,甚至分不清哪个应用要在哪个应用之前启动,架构师都不能完整的描述应用的架构关系。 这时,需要自动画出应用间的依赖关系图,以帮助架构师理清关系。

With the further development, the dependency relationship between services becomes more complex, and it is even unclear which application should be started before which application, and the architect can not describe the architecture relationship of the application completely. At this point, we need to automatically draw the dependency diagram between applications to help architects clarify the relationship.

接着,服务的调用量越来越大,服务的容量问题就暴露出来,这个服务需要多少机器支撑?什么时候该加机器? 为了解决这些问题,第一步,要将服务现在每天的调用量,响应时间,都统计出来,作为容量规划的参考指标。其次,要可以动态调整权重,在线上,将某台机器的权重一直加大,并在加大的过程中记录响应时间的变化,直到响应时间到达阈值,记录此时的访问量,再以此访问量乘以机器数反推总容量。

Then, with the increasing number of service calls, the problem of service capacity is exposed. How many machines does this service need to support? When should the machine be added? In order to solve these problems, the first step is to count the daily call volume and response time of the service as a reference index for capacity planning. Secondly, the weight of a machine should be adjusted dynamically. On line, the weight of a machine is increased all the time, and the change of response time is recorded in the process of increasing until the response time reaches the threshold value. Then, the total capacity is calculated by multiplying the number of machines by the number of visits.

架构

framework

调用关系说明

Call relation description

服务容器负责启动,加载,运行服务提供者。

The service container is responsible for starting, loading and running the service provider.

服务提供者在启动时,向注册中心注册自己提供的服务。

Service providers register their services with the registry at startup.

服务消费者在启动时,向注册中心订阅自己所需的服务。

The service consumer subscribes to the registry when it starts.

注册中心返回服务提供者地址列表给消费者,如果有变更,注册中心将基于长连接推送变更数据给消费者。

The registry returns the service provider address list to the consumer. If there is a change, the registry will push the change data to the consumer based on the long connection.

服务消费者,从提供者地址列表中,基于软负载均衡算法,选一台提供者进行调用,如果调用失败,再选另一台调用。

The service consumer selects one provider to call from the provider address list based on the soft load balancing algorithm. If the call fails, another provider is selected to call.

服务消费者和提供者,在内存中累计调用次数和调用时间,定时每分钟发送一次统计数据到监控中心。

Service consumers and providers accumulate the call times and call time in memory, and regularly send statistical data to the monitoring center once a minute.

Dubbo 架构具有以下几个特点,分别是连通性、健壮性、伸缩性、以及向未来架构的升级性。

Dubbo architecture has the following characteristics: connectivity, robustness, scalability, and upgrade to the future architecture.

连通性

Connectivity

注册中心负责服务地址的注册与查找,相当于目录服务,服务提供者和消费者只在启动时与注册中心交互,注册中心不转发请求,压力较小

The registry is responsible for the registration and search of service address, which is equivalent to directory service. Service providers and consumers only interact with the registry at startup, and the registry does not forward requests, so the pressure is small

监控中心负责统计各服务调用次数,调用时间等,统计先在内存汇总后每分钟一次发送到监控中心服务器,并以报表展示

The monitoring center is responsible for counting the call times and time of each service. The statistics are first summarized in the memory and then sent to the server of the monitoring center once every minute and displayed in a report form

服务提供者向注册中心注册其提供的服务,并汇报调用时间到监控中心,此时间不包含网络开销

The service provider registers its services with the registry and reports the call time to the monitoring center, which does not include network overhead

服务消费者向注册中心获取服务提供者地址列表,并根据负载算法直接调用提供者,同时汇报调用时间到监控中心,此时间包含网络开销

The service consumer obtains the service provider address list from the registry, and directly calls the provider according to the load algorithm, and reports the call time to the monitoring center, which includes network overhead

注册中心,服务提供者,服务消费者三者之间均为长连接,监控中心除外

Registration Center, service provider and service consumer are all long connection, except monitoring center

注册中心通过长连接感知服务提供者的存在,服务提供者宕机,注册中心将立即推送事件通知消费者

The registry senses the existence of the service provider through long connection. If the service provider fails, the registry will immediately push the event to inform the consumer

注册中心和监控中心全部宕机,不影响已运行的提供者和消费者,消费者在本地缓存了提供者列表

The registry and monitoring center are all down, which does not affect the running providers and consumers. Consumers cache the list of providers locally

注册中心和监控中心都是可选的,服务消费者可以直连服务提供者

Both the registry and the monitoring center are optional, and the service consumer can directly connect to the service provider

健壮性

Robustness

监控中心宕掉不影响使用,只是丢失部分采样数据

Monitoring center downtime does not affect the use, only part of the sampling data is lost

数据库宕掉后,注册中心仍能通过缓存提供服务列表查询,但不能注册新服务

After the database is down, the registry can still provide service list query through cache, but can not register new services

注册中心对等集群,任意一台宕掉后,将自动切换到另一台

The peer-to-peer cluster in the registry will automatically switch to the other when any one of them fails

注册中心全部宕掉后,服务提供者和服务消费者仍能通过本地缓存通讯

After all the registries are down, service providers and service consumers can still communicate through the local cache

服务提供者无状态,任意一台宕掉后,不影响使用

The service provider is stateless, and the usage will not be affected after any one of them is down

服务提供者全部宕掉后,服务消费者应用将无法使用,并无限次重连等待服务提供者恢复

After all the service providers are down, the service consumer application will not be able to use and will be reconnected indefinitely for the service provider to recover

伸缩性

Scalability

注册中心为对等集群,可动态增加机器部署实例,所有客户端将自动发现新的注册中心

The registry is a peer-to-peer cluster, which can dynamically add machine deployment instances, and all clients will automatically discover new registries

服务提供者无状态,可动态增加机器部署实例,注册中心将推送新的服务提供者信息给消费者

The service provider is stateless and can dynamically add machine deployment instances. The registry will push new service provider information to consumers

升级性

Upgradability

当服务集群规模进一步扩大,带动 IT 治理结构进一步升级,需要实现动态部署,进行流动计算,现有分布式服务架构不会带来阻力。

When the scale of service cluster is further expanded and it governance structure is further upgraded, dynamic deployment and flow calculation are needed. The existing distributed service architecture will not bring resistance.


速搜资源网 , 版权所有丨如未注明 , 均为原创丨转载请注明原文链接:【速搜问答】Dubbo是什么
喜欢 (0)
[361009623@qq.com]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址