Dubbo3 provides Triple (Dubbo3) and Dubbo2 protocols, which are native protocols of the Dubbo framework. In addition, Dubbo3 also integrates many third-party protocols and incorporates them into Dubbo programming and service governance system, including gRPC, Thrift, JSON-RPC, Hessian2, and REST. The following part highlights the Triple and Dubbo2 protocols.
The Triple protocol is the main protocol launched by Dubbo3. Triple means the third generation. Thanks to the evolution of Dubbo1.0 and Dubbo2.0 protocols and the trend of technological standardization brought by cloud native, Triple, a new Dubbo3 protocol, comes into being.
Protocols are the core of RPC, which standardizes the content and format of data transmitted on the network. On top of the required request and response data, the RPC protocol usually contains additional control data, such as the serialization mode, timeout period, compression mode, and authentication information of a single request.
The content of the protocol consists of three parts:
The following contents need to be considered for designing the RPC protocol:
Compared with private RPC protocols built directly on the TCP transport layer, the remote call solution built on HTTP will have better universality, such as Web Services or REST architecture. In addition, using HTTP and JSON can be regarded as a de facto standard solution.
Two biggest advantages of choosing to build on top of HTTP include:
However, HTTP is also faced with several obvious problems:
The preceding part discusses advantages and disadvantages of building RPC protocols based on HTTP and TCP. Compared with Dubbo built on TCP transport layer, Google chooses to define gRPC directly on top of HTTP/2.
The benefits of gRPC are inherited from HTTP/2 and Protobuf, including:
But problems also exist:
Finally, we chose compatible gRPC and built a new protocol, Triple, with HTTP2 as the transport layer. The rise of containerized applications and micro-services has facilitated the development for load content optimization technologies. The traditional communication protocols used by clients, such as RESTFUL or other HTTP-based customized protocols, are difficult to meet the requirements of applications in terms of performance, maintainability, extensibility, security, and other convenience. A cross-language, modular protocol will gradually become a new protocol standard of application development. Since the gRPC protocol became a CNCF project in 2017, more infrastructure and business including K8s and etcd have begun to use the gRPC ecosystem. As a micro-service framework of Cloud native, a new protocol of Dubbo is also perfectly compatible with gRPC. Moreover, Triple will also enhance and supplement some imperfect parts of the gRPC protocol.
So, does the Triple protocol solve the problems mentioned above? In short, yes. Let's evaluate the suitability of this protocol in terms of several aspects:
Further extension based on the gRPC protocol
tri-service-version
{Dubbo service version}tri-service-group
{Dubbo service group}tri-trace-traceid
{tracing id}tri-trace-rpcid
{_span id _}tri-unit-info
{cluster infomation}Service-Version and Service-Group respectively identify the version and group information of Dubbo service. Because the path of gRPC declares service name and method name, version and group information of gRPC are missing when compared with Dubbo protocol. Tracing-ID and Tracing-RPC-ID are used for the ability to end-to-end tracing, respectively indicating the information of tracing ID and span ID. Cluster-Info indicates cluster information, which can be used to build some flexible service governance capabilities related to routing such as cluster division.
Compared with the traditional unary mode, the Triple protocol provides Streaming RPC capabilities.
In some application scenarios such as large file transmission and live broadcasting, consumers or providers need to transmit a great deal of data with opposite ends. In these cases, the amount of data is very large, which cannot be transmitted in an RPC data packet. Therefore, after sharding data packets, we need to transmit those data packets through multiple RPCs. If we transmit these split RPC data packets in parallel, the relevant data packets are unordered after arriving at the opposite end, and the received data needs to be sorted and spliced. The relevant logic will be complicated. However, if we carry out serial transmission of split RPC data packets, the corresponding RTT of network transmission and latency of data processing will be long.
In order to solve the above problems and to transfer a large amount of data between consumers and providers in a pipelined manner, the Streaming RPC model comes into being.
By using the Streaming RPC mode of the Triple protocol, data streaming is implemented based on multiple long connections in the user state that are established between consumers and providers. Multiple Streams can exist on the same TCP connection at the same time, and each Stream is identified by Stream ID. Packets on a Stream are read and written in sequence.
In the field of API, the most important trend is the rise of the standardization technology. The Triple protocol is the main protocol launched by Dubbo3. It adopts a hierarchical design, and its data exchange format is developed on the basis of Protobuf (Protocol Buffers) protocol. It has excellent serialization and deserialization efficiency. Also, it supports multiple serialization methods and many development languages. In the protocol at the transport layer, Triple selects HTTP/2 that improves the transmission efficiency, compared with HTTP/1.1. In addition, as a mature open standard, HTTP/2 has rich security, flow control and other capabilities, as well as good interoperability. Triple can be used not only for server-side service calls, but also for browsers, mobile apps, and IoT devices to interact with backend services. At the same time, the Triple protocol seamlessly supports the all service governance capabilities of Dubbo3.
In the trend of cloud native, the demands for interoperability among cross-platform, cross-vendor, and cross-environment systems will inevitably bring RPC technologies based on open standards. The gRPC conforms to the trend of development and has been more widely used. In the field of micro-services, the proposal and implementation of the Triple protocol represent a big step for Dubbo3 towards micro-services of cloud native.
Status (8 bits)Only useful when Req/Res is 0 (Response), identifies the status of response
Every part is a byte[] after serialization with specific serialization type, identifies by Serialization ID
1. If the content is a Request (Req/Res = 1), each part consists of the content, in turn is:
2. If the content is a Response (Req/Res = 0), each part consists of the content, in turn is:
Note: For the Variable Part, when the current Dubbo framework uses JSON serialization, additional line feeds are added as separators between each part of the content. Add additional line feeds after each part of the Variable Part, such as:
Dubbo version bytes (line feed)
Service name bytes (line feed)
...
A Practical Guide on Dubbo-Admin Function Display and Operations
Sealer Becomes CNCF Sandbox Project to Build New Standards for Distributed Application Delivery
508 posts | 49 followers
FollowAlibaba Cloud Native Community - August 1, 2024
Alibaba Cloud Native Community - January 26, 2024
Alibaba Cloud Native Community - August 23, 2023
Alibaba Cloud Native - September 8, 2022
Alibaba Cloud Native Community - January 26, 2024
Alibaba Cloud Native Community - December 1, 2023
508 posts | 49 followers
FollowAccelerate and secure the development, deployment, and management of containerized applications cost-effectively.
Learn MoreHTTPDNS is a domain name resolution service for mobile clients. It features anti-hijacking, high accuracy, and low latency.
Learn MoreEMAS HTTPDNS is a domain name resolution service for mobile clients. It features anti-hijacking, high accuracy, and low latency.
Learn MoreAlibaba Cloud Function Compute is a fully-managed event-driven compute service. It allows you to focus on writing and uploading code without the need to manage infrastructure such as servers.
Learn MoreMore Posts by Alibaba Cloud Native Community