By Jun Liu
Whether you are a developer, architect, or CTO deeply involved in microservice development, you may have questions about choosing the right open-source microservice framework or system: Apache Dubbo, Spring Cloud, gRPC, or Service Mesh systems like Istio. This article provides a detailed explanation of these frameworks and offers guidance on selection, aiming to assist microservice developers.
It should be noted that the author of this article has extensive experience in the Apache Dubbo community. Therefore, the entire article is based on Dubbo. While objectively and transparently highlighting the connections and differences between Dubbo and other components, the article presents the advantages and applicable scenarios of several open-source products. Some content in the article may overemphasize the strengths of the Apache Dubbo project. However, it does not hinder our overall understanding of each product and the valuable guidance it provides for selection.
As we can see from the diagram above, Dubbo and Spring Cloud have many similarities.
• Both Dubbo and Spring Cloud focus on abstracting common problem patterns in distributed systems, such as service discovery, load balancing, and dynamic configuration. They provide component implementations to address these problems, creating a comprehensive microservice solution that allows users to focus on business logic development.
• Dubbo and Spring Cloud are fully compatible with the Spring system's application development model. Dubbo is well-adapted to the Spring application development framework and the Spring Boot microservice framework. Spring Cloud, being developed from the Spring system, naturally has perfect compatibility.
Despite their similarities, Dubbo and Spring Cloud differ significantly in terms of performance, suitable microservice cluster scale, production stability assurance, and service governance due to their different origins and architectural designs.
The advantages of Spring Cloud are as follows:
• With native support for the Spring development system, Spring Cloud offers more extensive support.
• It abstracts commonly used microservice models, such as service discovery, dynamic configuration, and asynchronous messaging, and explores areas like batch tasks, scheduled tasks, and persistent data access.
• The communication mode based on HTTP + JSON is more developer-friendly and cost-effective for development, testing, and integration with upstream and downstream systems.
• Spring Cloud's official website provides comprehensive introductory documents, demos, and starters, including books and materials, making it easier for developers to get started.
However, Spring Cloud also has its disadvantages, including:
• It only provides definitions of abstract patterns and does not offer official stable implementations. Developers can only seek implementation kits from different manufacturers, such as Netflix, Alibaba, and Azure, each of which may vary in terms of sophistication, stability, and popularity.
• While it is easy to get started with demos, the implementation, promotion, and long-term use can be costly.
• Spring Cloud lacks service governance capabilities, particularly in traffic control. It exhibits weaknesses in load balancing and traffic routing.
• The programming model and communication protocol are bound to HTTP, which poses obstacles to performance and interoperability with other RPC systems.
• The overall architecture and implementation are more suitable for small-scale microservice clusters. When the cluster scale increases, it encounters various bottlenecks, such as inefficient address push and high memory usage, making it challenging to migrate to other systems.
• High-level problems in microservice scenarios need to be solved by users, such as graceful shutdown, startup preheating, service testing, dual registration, dual subscription, delayed registration, service isolation by group, and cluster fault tolerance.
Dubbo, on the other hand, addresses these disadvantages and offers several advantages:
• It fully supports the Spring and Spring Boot development modes and provides capabilities equivalent to Spring Cloud in basic modes such as service discovery and dynamic configuration.
• It is a comprehensive output of enterprise-level microservice practices. Dubbo considers various problems encountered in enterprise microservice practices, such as graceful offline and online, multiple registries, traffic management, and abnormal instance isolation. Consequently, its long-term maintenance cost in a production environment is lower.
• It offers greater flexibility in choosing communication protocols and encodings, including RPC communication layer protocols like Triple (compatible with gRPC and HTTP/1), TCP binary protocol, and REST, as well as serialization encoding protocols like Protobuf, JSON, and Hessian2. It also supports single-port multi-protocol.
• Dubbo is designed with a focus on service governance capabilities, such as dynamic weight adjustment, label routing, and conditional routing. It supports multiple modes, including Sidecar and Proxyless, to integrate with the Service Mesh system.
• It is a high-performance RPC protocol encoding and implementation.
• Dubbo is developed in the context of ultra-large-scale microservice clusters, capable of scaling up to clusters with millions of instances and addressing various problems associated with cluster growth.
• Dubbo provides multi-language implementations other than Java, enabling the construction of heterogeneous microservice systems in languages such as Java, Go, Node.js, Rust, and Web.
If your goal is to build enterprise-level applications and expect a more worry-free and stable maintenance experience in the future, we recommend gaining a deeper understanding of Dubbo and the capabilities it provides.
When comparing these two open source products, we can focus on two aspects: their product positioning and protocol comparison.
Difference in Product Positioning
The main distinction between Dubbo and gRPC lies in their positioning:
• gRPC is positioned as an RPC framework. Its primary objective, as developed by Google, is to define the specifications and standard implementations for RPC communication in the cloud-native era.
• Dubbo is positioned as a microservice development framework. It specifically addresses the challenges faced in microservice practices, including service definition, development, communication, and governance. As a result, Dubbo offers capabilities such as RPC communication, integration with application development frameworks, and service governance.
Dubbo is not limited to a specific communication protocol. This means that Dubbo services can communicate with each other using various RPC protocols and support flexible switching between them. Consequently, it is possible to use gRPC for communication within microservices developed with Dubbo. Dubbo achieves full compatibility with gRPC using the Triple protocol and includes gRPC as one of its built-in native protocols.
The Triple protocol, developed by Dubbo3, is an HTTP-based RPC communication protocol specification. It is fully compatible with the gRPC protocol and supports communication models such as Request-Response and Streaming. It can operate simultaneously on HTTP/1 and HTTP/2.
The Dubbo framework offers multiple language implementations of the Triple protocol, which can assist in building browsers and gRPC-compatible HTTP API interfaces. You only need to define a standard Protocol Buffer format service and implement the business logic. Dubbo takes care of generating language-specific Server Stubs and Client Stubs, seamlessly integrating the entire calling process into the Dubbo system, including routing and service discovery. The native Triple protocol implementations in languages like Go and Java support HTTP/1 transport layer communication. Compared to the official gRPC implementation, the Dubbo framework provides a simpler and more stable protocol implementation, making it easier to develop and manage microservice applications.
For certain language versions, the Dubbo framework also offers programming modes that are better suited to the language features. 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 the Triple protocol communication.
As mentioned earlier, Triple is fully compatible with the gRPC protocol. However, Dubbo implements it through Triple for two primary reasons:
• In terms of protocol design, Dubbo has developed a custom Triple protocol based on references from gRPC and gRPC-Web protocols. Triple is an RPC protocol based on the HTTP transport layer protocol. It is fully compatible with gRPC and can operate on both HTTP/1 and HTTP/2 simultaneously.
• The Dubbo framework follows a design concept that aligns with its positioning during the implementation in each language. Compared to framework libraries like grpc-java and grpc-go, the Dubbo protocol implementation is simpler, purer, and attempts to avoid issues found in the official gRPC library.
By using the Dubbo framework and enabling the Triple protocol, you can create microservices compatible with the gRPC protocol. Developers can develop services based on Dubbo's APIs and configurations and manage services using Dubbo's service governance capabilities. Compared to the native gRPC protocol, the Triple protocol facilitates easier debugging and frontend access by supporting cURL and direct access from browsers.
curl \
--header "Content-Type: application/json" \
--data '{"sentence": "Hello Dubbo."}' \
https://host:port/org.apache.dubbo.sample.GreetService/sayHello
Service Mesh is a microservices architecture that has emerged in the cloud-native era in recent years. In the Kubernetes ecosystem, Service Mesh provides additional capabilities for microservice development, such as traffic interception and service governance, which are integrated into the infrastructure to make microservice development and upgrades more lightweight. Istio is an open-source implementation of Service Mesh. It consists of a data plane and a control plane in terms of deployment architecture, which is similar to the overall architecture of Dubbo. Istio brings about the following main changes:
• In the data plane, Istio transparently intercepts service traffic by introducing Sidecars. Sidecars are usually deployed together with traditional microservice components developed using Dubbo and other frameworks.
• In the control plane, Istio consolidates the previously abstracted service governance center into a concrete component with a unified implementation. It also seamlessly integrates with underlying infrastructure like Kubernetes.
Dubbo has implemented full integration with the Istio system. You can use the Istio control plane to manage Dubbo services. In terms of the data plane deployment architecture, Dubbo also supports a Proxyless mode to address complexity and performance issues introduced by Sidecars. Additionally, the Dubbo Mesh system solves many challenges in implementing the Istio architecture by providing a more flexible data plane deployment architecture and reducing migration costs.
From the data plane perspective, Dubbo supports the following two development and deployment modes. You can implement service governance on the data plane using control plane components such as Istio:
• In Proxy mode, Dubbo and Envoy are deployed together. Dubbo serves as a programming framework and protocol communication component, while Envoy interacts with the Istio control plane to implement traffic control.
• In Proxyless mode, Dubbo processes are deployed independently. Dubbo directly connects to Istio and other control plane components through the standard xDS protocol.
From the control plane perspective, Dubbo can access the native Istio standard control plane and rule system. For users of older versions of Dubbo, the community will collaborate with enterprise users to provide a smooth migration solution for the community version.
This article focuses on Dubbo and provides a detailed introduction to various framework products such as Spring Cloud, Dubbo, gRPC, and Istio, highlighting their respective strengths and differences. It aims to assist in selecting microservice technologies. However, it is important to note that this article is based on Dubbo and emphasizes the strengths of the Apache Dubbo project. In the future, we will expand the article from different perspectives, providing more product comparisons and guidance.
Best Practices for Microservices: Achieve Interoperability Between Spring Cloud and Apache Dubbo
Decipher the Elastic Technology of Knative's Open Source Serverless Framework
507 posts | 48 followers
FollowAlibaba Cloud Native - February 15, 2023
Alibaba Cloud Native Community - December 19, 2023
Alibaba Cloud Native Community - April 6, 2023
Alibaba Container Service - September 13, 2024
Alibaba Cloud Native - September 8, 2022
Alibaba Cloud Native Community - January 26, 2024
507 posts | 48 followers
FollowMSE provides a fully managed registration and configuration center, and gateway and microservices governance capabilities.
Learn MoreAlibaba Cloud Service Mesh (ASM) is a fully managed service mesh platform that is compatible with Istio.
Learn MoreMulti-source metrics are aggregated to monitor the status of your business and services in real time.
Learn MoreMore Posts by Alibaba Cloud Native Community