Six kinds of micro-RPC service framework, you know a few?

RPC open source framework, what does?

One is with a specific platform language bindings, the other is independent of the language that is cross-language platform.

RPC framework with the open-source platform language bindings are the following categories.

  • Dubbo: one of the earliest open source RPC framework, developed by Alibaba in late 2011 and the external open source, supports only the Java language.

  • Motan: RPC framework for the internal use of micro-Bo, the external revenue in 2016, supports only the Java language.

  • Tars: RPC framework Tencent internal use of foreign revenue in 2017, supports only C ++ language.

  • Spring Cloud: Pivotal foreign company RPC 2014 Foreign open source framework, supports only the Java language

The cross-platform open-source language RPC framework are the following.

  • gRPC: Google in 2015, the external open source cross-language RPC framework that supports multiple languages.

  • Thrift: Originally across the internal systems developed by Facebook language RPC framework, in 2007 contributed to the Apache Foundation, became one of Apache open source project, supports multiple languages.

If your business scenario confined to one language, you can select a language RPC framework with binding in;

If it involves mutual calls between multiple language platforms, you should select cross-platform language RPC framework.


RPC framework, their specific What's the difference?

1. Dubbo

First to talk about Dubbo, Dubbo can be said is the first open source framework for the RPC, currently only supports Java language, its architecture can use this chart below shows.

v2-db5d203d52d633383e643e43e8c4e58f_b.jpg


You can see from the figure, Dubbo architecture consists of four main characters, which is Consumer service consumer, Provider is a service provider, Registry is the registry, Monitor is a monitoring system.

Specific interaction process is to get the Consumer end node Provider Registry, Provider through Dubbo establish a connection with the client SDK, and initiate calls. Provider Consumer end request received by the server SDK Dubbo, the process then returns the result to the Consumer.

2. Motan

Motan is the addition of a well known open source RPC framework that also supports only the Java language, its architecture can be described with the image below.

v2-cbf14748ec9cc4ce9aa87255dbf95f0f_b.jpg


Motan architecture similar to Dubbo, we need to introduce the SDK Client-side (customer service) and Server-side (service provider), Motan framework which mainly contains the following functional modules.

  • register: Registration and center for interaction, including registration services, subscription services, service change notification service send heartbeat and other functions.

  • protocol: used to describe RPC services RPC services and configuration management, this layer can also add different functions of filter used to complete the statistics, concurrency limitations and other functions.

  • serialize: RPC request object parameters, like the serialization and deserialization

  • transport: for remote communications, the default TCP Netty NIO long way links.

  • cluster: When requests are based on different high availability and load balancing policy to select one of the available Server to initiate a remote call.

3. Tars

Tars are based on years of practice to use Tencent micro-service architecture of the interior, from the open source project summary, only supports C ++ language, its architecture is shown below.

v2-fb3f24ede96525e9cf078e5d539f3e38_b.jpg


Tars interaction of architecture includes the following processes:

  • Service publishing process: upload server release package to patch in a web system, after a successful upload, publish on the web server to submit a request, conveyed by a registry service to the node, then the node pull release package to a local server, pull the server service.

  • Order management process: management server can submit a service request command, communicated by the registry service to the service node then sends a command to the management server node on the web by the system.

  • Heartbeat reporting process: After the server service is running, regularly report the heartbeat to node, node heartbeat information is then reported to the service registry service, unified management by the registry.

  • 信息上报流程:server 服务运行后,会定期上报统计信息到 stat,打印远程日志到 log,定期上报属性信息到 prop、上报异常信息到 notify、从 config 拉取服务配置信息。

  • client 访问 server 流程:client 可以通过 server 的对象名 Obj 间接访问 server,client 会从 registry 上拉取 server 的路由信息(如 IP、Port 信息),然后根据具体的业务特性(同步或者异步,TCP 或者 UDP 方式)访问 server(当然 client 也可以通过 IP/Port 直接访问 server)。

4. Spring Cloud

Spring Cloud 利用 Spring Boot 特性整合了开源行业中优秀的组件,整体对外提供了一套在微服务架构中服务治理的解决方案。

只支持 Java 语言平台,它的架构图可以用下面这张图来描述。


v2-cade4fe83bffcb193c05c68f63990c2e_b.jpg


由此可见,Spring Cloud 微服务架构是由多个组件一起组成的,各个组件的交互流程如下。

  • 请求统一通过 API 网关 Zuul 来访问内部服务,先经过 Token 进行安全认证。

  • 通过安全认证后,网关 Zuul 从注册中心 Eureka 获取可用服务节点列表。

  • 从可用服务节点中选取一个可用节点,然后把请求分发到这个节点。

  • 整个请求过程中,Hystrix 组件负责处理服务超时熔断,Turbine 组件负责监控服务间的调用和熔断相关指标,Sleuth 组件负责调用链监控,ELK 负责日志分析。

5. gRPC

先来看下 gRPC,它的原理是通过 IDL(Interface Definition Language)文件定义服务接口的参数和返回值类型,然后通过代码生成程序生成服务端和客户端的具体实现代码,这样在 gRPC 里,客户端应用可以像调用本地对象一样调用另一台服务器上对应的方法。

v2-b31eb7af267ac80c56bc351957bf687f_b.jpg


它的主要特性包括三个方面。

  • The communication protocol uses HTTP / 2, because the HTTP / 2 provides connection multiplexing, bi-directional flow, a push server, a request priority, the header compression mechanism

  • IDL uses ProtoBuf, ProtoBuf was developed by Google A data serialization protocol, its high compression and transmission efficiency, simple syntax

  • Multi-language support, multiple languages ​​can be automatically generated based on the corresponding language of the client and server code.

6. Thrift

Then look at the Thrift, Thrift is a lightweight cross-language RPC communications program to support up to 25 programming languages. In order to support multiple languages, with gRPC the same, Thrift also will have its own interface definition language IDL, code generator can generate a variety of programming languages ​​Client-side and Server SDK code, thus ensuring between different languages ​​can communicate with each other. It can be used at FIG architecture described in FIG.

v2-e70715c07fa0a38184683abe63812d10_b.jpg


This can be seen from the characteristic Thrift RPC framework.

  • Support multiple format sequence: The Binary, Compact, JSON, Multiplexed like.

  • It supports multiple communication modes: as Socket, Framed, File, Memory, zlib like.

  • Server supports a variety of treatments: The Simple, Thread Pool, Non-Blocking and the like.


About Micro service I summed up a technical route, for everyone to share

v2-673413c2ec13277aaf7c7c673b8dd23c_b.jpg

Finally,
we welcome the exchange, like the point of a praise yo remember the article, thanks for the support!



Guess you like

Origin blog.51cto.com/14442094/2431203