×
Community Blog Dubbo 3.2: New Features and Enhancements for Cloud Nativeization

Dubbo 3.2: New Features and Enhancements for Cloud Nativeization

The article announces the release of Dubbo 3.2, which introduces new features and enhancements that make it more powerful and easier to use.

By Dubbo Community

We are thrilled to announce the official release of Dubbo 3.2! This version introduces many new features and improvements and represents a significant step towards the cloud nativeization of Dubbo.

Background

Apache Dubbo is an RPC service development framework that solves service governance and communication issues in microservice architecture. Dubbo officially provides multi-language SDK implementations such as Java and Golang. Microservices developed using Dubbo can easily communicate with one another through remote address discovery. Dubbo offers extensive service governance features that enable service discovery, load balancing, and traffic scheduling. Dubbo is highly scalable, and users can implement custom logic for traffic interception and location selection.

1. Rest Protocol Support

1.1 Why Rest?

With the rise of mobile internet, more and more applications need to integrate with different systems that may use different communication protocols. This requires applications to be flexible enough to adapt to various protocols. The Rest protocol is a highly flexible protocol that uses HTTP for communication and can easily integrate with almost any system.

In the past, RPC frameworks used binary protocols for communication, which were highly efficient but lacked flexibility. In contrast, the Rest protocol uses HTTP for communication, making it easier to integrate with other systems, modern web, and mobile applications.

Apart from flexibility, the Rest protocol is easy to read and use. Developers can test and debug services with generic HTTP tools such as cURL and Postman, without the need for specific tools. Additionally, because Rest protocol uses standard HTTP methods such as GET, POST, PUT, and DELETE, developers can easily understand and use the service.

1.2 How To?

In previous Dubbo versions, the Rest protocol was supported, but it came with some issues:

• Only JAX-RS annotations were supported, which are more complex than the widely adopted Spring Web annotations.
• It required several external components such as Resteasy, Tomcat, and Jetty to function properly, increasing the cost of usage.

To address these issues, Dubbo 3.2 introduces support for Spring Web annotations and native Rest protocol support without relying on any external components.

The most significant difference is that services published through Spring Web can be directly published through Dubbo by simply replacing the @Controller annotation with the @DubboService annotation when upgrading to Dubbo 3.2.

Furthermore, with this feature, users who partition microservices using Spring Boot or Spring Cloud can smoothly migrate to Dubbo at a low cost to leverage Dubbo's powerful capabilities.

1.3 What's Next?

Dubbo strives to continuously improve to better meet the evolving needs of our users. In addition to the existing features, we are excited to announce the addition of the following new features:

  1. Native support for HTTP/2 and HTTP/3 protocols, which enables seamless communication between Dubbo and other systems without worrying about protocol compatibility issues.
  2. Native support for Spring Web annotations, which provides an experience similar to using Spring Web without relying on it.
  3. Support for zero transformation of existing services to be released using the Rest protocol. This feature allows you to manage your services more flexibly without any changes to existing services, enabling you to publish your services through the Rest protocol and make them more easily accessible to other systems.

2. Observability System

In a microservices architecture, a business system is composed of multiple services that interact with each other. The challenge that arises is how to quickly identify and resolve faults in a timely manner. To address this challenge, we need tools and technologies that ensure the reliability of the entire system. One solution is to utilize log recording and analysis to track application performance, identify potential issues, and resolve them promptly. Additionally, visual monitoring tools help us understand the state of the entire system, enabling us to predict and address problems more effectively. Finally, automated testing ensures the quality of each service, enhancing the stability and reliability of the entire system, ultimately better meeting customer needs.

A complete observability system should include the following functions:

Metrics for collecting and analyzing system performance and resource consumption, enabling users to stay informed about the system's operation and identify and address exceptions.

Tracing to trace call chains between services in the system, providing insights into operation, identifying potential performance problems and bottlenecks, and facilitating effective optimization and adjustments.

Logging to record various events and operations in the system, including error logs, access logs, and transaction logs, enabling users to understand system operation and fault information, locate problems quickly, and take appropriate actions.

In summary, these three functions help users quickly locate faults, improve system reliability and stability, and gain deep insight into system operation and performance.

Dubbo 3.2 has enhanced both Metrics and Tracing to better support these functions.

2.1 Metrics

In terms of Metrics, we have greatly improved event tracking using Micrometer, which includes core service metrics such as QPS, RT, total number of calls, and success/failure rates, as well as failure cause statistics. To better monitor service operation, Dubbo offers monitoring of core component statuses, such as thread pool numbers and service health status. Moreover, Dubbo supports the Pull and Push modes of standard Prometheus and provides multiple official native Grafana panels, enabling round-the-clock observation of production-oriented Metrics.

1

For all users, you only need to upgrade to Dubbo 3.2 and add the dubbo-spring-boot-observability-starter dependency to obtain the Metrics capability. After the application is started, relevant metrics are exposed under the metrics command of Dubbo QoS. You can obtain the metrics locally at http://127.0.0.1:22222/metrics. In addition, for users who use Spring Actuator, Dubbo automatically exposes this data.

2.2 Tracing

In terms of Tracing, we have implemented event tracking of request runtime using Micrometer and realized this function natively through the Filter interceptor. We support exporting trace data to mainstream implementations such as Zipkin, Skywalking, and Jaeger, enabling the analysis and visualization of trace data for a comprehensive process.

2

2.3 Logging

In terms of Logging, Dubbo introduced an error code mechanism since version 3.1, achieving full coverage of WARN- and ERROR-level logs. In abnormal scenarios, the solution documents on the official website can be quickly indexed.

3. Native Support of Native Image

In terms of Native Image, Dubbo will officially support Native Image based on GraalVM from version 3.2. Although Dubbo had explored some support for Native Image since version 3.0, the support was inefficient and had low ease of use. Starting from version 3.2, Dubbo has simplified the way users access Native Image, mainly through the following three aspects:

  1. The original native-image-maven-plugin is replaced with dubbo-maven-plugin + native-maven-plugin, which distinguishes the native image configuration officially provided by GraalVM from the native image configuration required by Dubbo, simplifying the native image configuration that users need to care about.
  2. In the old version, users had to manually generate and complete the unique Adaptive code in Dubbo. In the new version, users no longer need to handle these details manually.
  3. In the old version, the configuration files under the META-INF.native-image generated by the Dubbo framework were in the users' project directory. In contrast, the configuration files are compiled to the target in the new version, which does not affect the users' project structure. Additionally, instead of manually completing native images, the Dubbo framework automatically detects and generates the necessary configuration files, simplifying the development process for Dubbo developers. This reduces the size of the final compiled binary package and improves compilation speed.

In addition to improved ease of use, Dubbo will support API, annotation, and XML configuration methods in native image scenarios in version 3.2 and ensure native compatibility with Spring Boot 3.

4. Others

4.1 Native Support of JDK 17 & Spring Boot 3

JDK 17 is the latest LTS release of Java following JDK 11, and it offers many new features and improvements, such as enhanced Sealed classes and garbage collector.

Since JDK 16 began restricting inner classes with Java reflection, Dubbo's serialization and dynamic proxy functionality have been affected to some extent. However, in Dubbo 3.2, we addressed this issue by optimizing Fastjson2 and Javassist from the bottom layer, enabling Dubbo to run seamlessly on JDK 17. Currently, all unit tests and most integration tests have passed on the JDK 17 platform.

Looking ahead, Dubbo is actively preparing to adapt to JDK 21 LTS and support Dubbo coroutine, Project Loom in Dubbo 3.3.

4.2 Significant Increase in RPC Performance

In version 3.2, we have fine-tuned the RPC call performance in several ways:

  1. Eliminated synchronization lock contention and blocking code.
  2. Reduced request-response latency for synchronous blocking calls.
  3. Reduced the number of thread switches.
  4. Optimized I/O performance.
  5. Supported serialized messages on user threads.

Compared to version 3.1, version 3.2 demonstrates the following performance improvements:

Triple protocol: In smaller message scenarios like createUser, existUser, and getUser, the improvement rate is approximately 40-45% - equivalent to that of the same gRPC scenario. In the larger message scenario listUser, the improvement rate is about 17%, which is 11% lower than the same gRPC scenario.

Dubbo protocol: In smaller message scenarios like createUser and existUser, the improvement rate is about 180%. In the minimum message scenario existUser (only a boolean value), the improvement rate is about 24%. In the largest message scenario listUser, the improvement rate is the highest, reaching 1000%!

3
4

5. How to Upgrade to Dubbo 3.2

5.1 The Latest Dubbo Maven Coordinates Upgraded by Pom

<dependency>        
    <groupId>org.apache.dubbo</groupId>        
    <artifactId>dubbo</artifactId>        
    <version>3.2.0</version>
</dependency>

5.2 Compatibility

For most users, upgrading to Dubbo 3.2.0 is smooth, and only the dependency package version needs to be modified.

1. Enhancement of Serialization Validation Logic (Important)

In Dubbo 3.2.0, we have enabled strong validation of serialization whitelists by default to improve Dubbo security and prevent remote command execution. The current mechanism trusts partial classes automatically through the package name recursion mechanism. However, for users who utilize generics resulting in incomplete scanning, we recommend adding the -Ddubbo.application.serialize-check-status=WARN configuration. After observing the logs and QoS commands for a certain period, if no security alerts are triggered, you can configure the strong verification mode.

For more information on how to configure a custom whitelist, please refer to the official website's "Documentation/SDK manual/Java SDK/Advanced features and usage/Improve security/Class check mechanism".

2. Modification of Default Serialization

Dubbo 3.2.0 begins to switch the default serialization mode from Hessian2 to Fastjson2. For applications upgraded to 3.2.0, Dubbo will automatically use Fastjson2 for serialization. Please note that as long as one client or server side has not been upgraded to version 3.2.0, both sides will be downgraded to use Hessian2 for serialization to ensure compatibility.

3. Push Empty Protection is Disabled by Default.

Push empty protection is intended to maintain the last batch of provider information to ensure service availability when the registry fails and actively pushes empty addresses. However, in most cases, the registry will not push empty addresses even if it fails, which only occurs in some special cases. Enabling push empty protection will greatly affect the fallback logic and heartbeat logic of Dubbo, making it difficult for developers to use Dubbo.

If you want to enable push empty protection for high availability in the production environment, you can set the dubbo.application.enable-empty-protection parameter to true. However, please note that enabling empty push protection will make server applications fail to roll back to the original version when upgrading from version 2.6.x and 2.7.x, which only support interface-level service discovery, to version 3.x. In extreme cases, service calls may fail.

6. Summary

Dubbo 3.2 is an essential update, introducing a host of new features and improvements that enhance Dubbo's power and ease of use. We are thankful for the support and contributions of our community, and we encourage everyone to experience Dubbo 3.2 as soon as possible and enjoy its convenience and benefits.

0 1 0
Share on

You may also like

Comments

Related Products