Attention: The feature described in this doc is still under development or is in a very early stage, please keep updated!
The Triple protocol is an HTTP-based RPC communication protocol specification designed for Dubbo3, fully compatible with the gRPC protocol, supporting communication models like Request-Response and Streaming, and can run on both HTTP/1 and HTTP/2.
The Dubbo framework provides various language implementations of the Triple protocol, helping you build browser- and gRPC-compatible HTTP API interfaces: you only need to define a standard Protocol Buffer format service and implement business logic. Dubbo takes care of generating language-related Server Stub, Client Stub, and seamlessly integrates the entire invocation process with routing, service discovery, and other Dubbo systems. The Triple protocol implementations in languages like Go and Java natively support HTTP/1 transport layer communication. Compared to the official gRPC implementation, Dubbo’s protocol implementation is simpler and more stable, making it easier for you to develop and manage microservice applications.
For certain language versions, the Dubbo framework also provides programming modes that are more aligned with language features, such as service definition and development modes that do not bind to IDL. For example, in Dubbo Java, you can choose to define Dubbo services using Java Interfaces and Pojo classes and publish them as microservices based on Triple protocol communication.
With the Triple protocol, you can achieve the following goals:
The Dubbo Client can access Triple protocol services published by the Dubbo server and standard gRPC servers.
The Dubbo Server by default publishes support for both Triple and gRPC protocols simultaneously, and the Triple protocol can work over HTTP/1 and HTTP/2. Therefore, Dubbo Server can handle Triple protocol requests from Dubbo clients, standard gRPC protocol requests, as well as HTTP requests sent by cURL and browsers. The distinction based on Content-type is:
For details, refer to the detailed Triple Specification.
As mentioned above, Triple is fully compatible with the gRPC protocol. Given that gRPC has already provided multi-language framework implementations, why does Dubbo need to reimplement it through Triple? The core goals primarily include two points:
gRPC itself as an RPC protocol specification is excellent, but we found that the native gRPC library implementation has several issues in practical use, including complexity, IDL binding, and debugging difficulties. Dubbo, starting from practical implementation, effectively avoids these problems:
The Dubbo framework focuses on the Triple protocol itself while relying on well-tested network libraries for underlying network communication, HTTP/2 protocol parsing, etc. For example, Dubbo Java is built on Netty, while Dubbo Go directly uses Go’s official HTTP library.
The Triple protocol implementation provided by Dubbo is very simple, corresponding to the Protocol component implementation in Dubbo, and you can grasp Dubbo protocol code implementation in just one afternoon.
Since the release of Dubbo3, the Triple protocol has been widely used in Alibaba and many community benchmark enterprises, especially in scenarios involving proxy and gateway interoperability. On one hand, Triple has been proven reliable and stable through large-scale production practice; on the other hand, the simplicity, ease of debugging, and non-IDL binding design of Triple are also important factors for its widespread adoption.
When launching services externally using the Dubbo framework as a server, it can natively support Triple, gRPC, and HTTP/1 protocols on the same port. This means you can access the services published by Dubbo server in various forms, with all request forms ultimately being forwarded to the same business logic implementation, providing greater flexibility.
Dubbo is fully compatible with gRPC protocols and related features, including streaming, trailers, and error details. You can choose to directly use the Triple protocol in the Dubbo framework (or you can opt to use the native gRPC protocol), and then directly access your published services with the Dubbo client, cURL, browsers, etc. In terms of interoperability with the gRPC ecosystem, any standard gRPC client can normally access Dubbo services; Dubbo clients can also call any standard gRPC services. Here is a provided interoperability example.
Here is an example of using cURL client to access Dubbo server Triple protocol service:
curl \
--header "Content-Type: application/json" \
--data '{"sentence": "Hello Dubbo."}' \
https://host:port/org.apache.dubbo.sample.GreetService/sayHello
We all know that Dubbo has rich microservices governance capabilities, such as service discovery, load balancing, traffic control, etc. This is also one of the advantages of developing applications using the Dubbo framework. To use gRPC protocol communication in the Dubbo system, there are two ways to achieve it: one is to directly introduce the gRPC official published binary package into the Dubbo framework, and the other is to provide a natively compatible source implementation of the gRPC protocol within Dubbo.
Compared to the first method of introducing binary dependencies, the Dubbo framework natively supports the gRPC protocol through built-in Triple protocol implementation. The advantage of this approach is that the source code is entirely under your control, allowing for a closer integration of the protocol implementation with the Dubbo framework, enabling more flexible access to Dubbo’s service governance system.
In the Dubbo Java library implementation, you can define services using Java Interfaces in addition to IDL approaches, which can significantly reduce the cost of using the gRPC protocol for many Java users familiar with the Dubbo system.
Additionally, the protocol implementation in the Java version performs on par with the grpc-java library in performance, with even better performance in certain scenarios. All of this is built upon the fact that the implementation complexity of the Dubbo version protocol is much lower than that of the gRPC version, as grpc-java maintains a customized version of the netty protocol implementation.
Dubbo Go recommends the IDL development model, generating stub code through Dubbo’s accompanying protoc plugin. You only need to provide the corresponding business logic implementation, and you can access the gRPC services published by Dubbo Go through cURL and browsers.
Currently, we have provided Java and Go versions of the Triple protocol, and we plan to successively provide corresponding implementations in Rust, Python, Node.js, and other languages.