Advanced cloud native - Dubbo 3.2 officially released

Author: Dubbo Community

We are very happy to announce that Dubbo 3.2 has been officially released! This version brings many new features and improvements, which is also an important attempt of Dubbo in the face of cloud nativeization.

background introduction

Apache Dubbo is an RPC service development framework, which is used to solve service governance and communication problems under the microservice architecture. It officially provides multi-language SDK implementations such as Java and Golang. The microservices developed using Dubbo have native remote address discovery and communication capabilities with each other. Using the rich service governance features provided by Dubbo, service governance demands such as service discovery, load balancing, and traffic scheduling can be realized. Dubbo is designed to be highly scalable, and users can easily implement various custom logics for traffic interception and location selection.

01 Rest protocol support

1.1 Why Rest?

With the popularization of mobile Internet, more and more applications need to be integrated with different systems. And these systems may use different communication protocols, which requires the application program to be able to flexibly adapt to various protocols. The Rest protocol is a very flexible protocol that communicates using HTTP and can be integrated with almost any system.

In the past, RPC frameworks typically communicated using a binary protocol, which was very efficient but not flexible enough. In contrast, the Rest protocol uses HTTP for communication, which is easier to integrate with other systems, and it is also easier to integrate with modern web and mobile applications.

In addition to flexibility, the Rest protocol is also readable and easy to use. Using the Rest protocol, developers can test and debug services using common HTTP tools such as cURL or Postman, without the need for specific tools. Also, because the Rest protocol uses standard HTTP methods such as GET, POST, PUT, and DELETE, it makes it easier for developers to understand and consume the service.

1.2 How To?

In the previous Dubbo version, the Rest protocol support was also provided, but there were the following problems:

  • Only supports JAX-RS annotation fields, which is more complex than the more widely used Spring Web annotations
  • It needs to rely on many external components, such as Resteasy, tomcat, jetty, etc., to work normally, which greatly increases the cost of use.

Therefore, in Dubbo version 3.2, we introduced the support of Spring Web annotation domain and the native support of Rest protocol without relying on any external components.

The most intuitive difference is that if you upgrade to Dubbo 3.2, services published through Spring Web can also be published directly through Dubbo. All you need to do is change the @Controller annotation to @DubboService annotation.

In addition, for users who originally used Spring Boot or Spring Cloud as a service split, they can also migrate smoothly to Dubbo based on this function, and obtain the powerful capabilities of Dubbo at a very low cost.

1.3 What’s next?

Next, Dubbo will continue to improve. In addition to the existing features, we will also add the following new features to better meet the needs:

  1. Native support for HTTP/2 and HTTP/3 protocols. This means that you can use Dubbo to communicate with other systems more conveniently without worrying about protocol compatibility.
  2. Referring to Spring Web annotations, Dubbo natively provides support for Web annotations, so that users can get the same experience as using Spring Web without relying on Spring Web.
  3. Support zero transformation of existing services and publish them with the Rest protocol. This feature allows you to manage your services more flexibly without making any changes to existing services. You can publish your service through the Rest protocol, so that your service can be used by other systems more conveniently.

02 Observable system

Under the microservice architecture, the business system is composed of more and more services, and the services call each other. The ensuing problem is how to quickly locate the fault and solve it in time. In order to solve this problem, we need more tools and techniques to ensure the reliability of the whole system. One of the solutions is to use logging and analytics so that you can better track how your application is doing, find potential problems and fix them in a timely manner. In addition, using visual monitoring tools can help us better understand the status of the entire system, so as to better predict and solve problems. Finally, we can also use automated testing to ensure the quality of each service, as well as the stability and reliability of the entire system, so as to better meet customer needs.

A complete observable system should include the following functions:

  • Metrics indicator monitoring , used to collect and analyze various indicator data, including system performance, resource consumption, etc. Through indicator monitoring, users can keep abreast of the operation of the system, find abnormalities and take corresponding measures.
  • Tracing Distributed tracing is used to trace the call links between various services in the system, helping users discover and locate potential performance problems, bottlenecks, etc. Through distributed tracing, users can deeply understand the operation process of the system, identify possible problems and make effective optimization and adjustment.
  • Logging Log management is used to record various events and operations that occur in the system, including error logs, access logs, transaction logs, and so on. Through log management, users can learn about the running status of the system, fault information, etc., and help users quickly locate problems and handle them accordingly.

To sum up, the above three functions can not only help users quickly locate faults, improve system reliability and stability, but also help users deeply understand the operation and performance of the system, and provide users with comprehensive monitoring and protection.

In Dubbo version 3.2, we mainly enhanced Metrics and Tracing.

2.1 Metrics

In terms of metrics, we use Micrometer to greatly increase the buried points of indicators, including but not limited to core service indicators such as QPS, RT, total number of calls, number of successes, number of failures, and failure reason statistics. In order to better monitor the running status of services, Dubbo also provides monitoring of the status of core components, such as the number of thread pools, service health status, etc. In addition, Dubbo also supports the standard Prometheus Pull and Push modes, and provides several official native Grafana panels to achieve production-oriented Metrics all-weather observation.

insert image description here

For all users, only need to upgrade to Dubbo 3.2 version, and add dubbo-spring-boot-observability-starter dependency to get Metrics capability. After the application starts, relevant indicators will be exposed under the metrics command of Dubbo QoS, which can be obtained locally through http://127.0.0.1:22222/metrics . In addition, for users who use Spring Actuator, Dubbo will also expose these data by default.

2.2 Tracing

In terms of Tracing, we also implemented tracking of buried points during request runtime based on Micrometer. We achieve this function through the native way of Filter interceptor. We support exporting trace data to some mainstream implementations, such as Zipkin, Skywalking, Jaeger, etc. In this way, the analysis and visual display of the full link tracking data can be realized.

insert image description here

2.3 Logging

In addition, for Logging, Dubbo has introduced an error code mechanism since version 3.1, realizing full coverage of WARN and ERROR level logs. In abnormal scenarios, it supports quick indexing of official website resolution documents.

03 Native Image native support

In terms of Native Image, Dubbo will officially support Native Image based on GraalVM starting from 3.2. Starting from Dubbo3.0, Dubbo has already explored some Native Image support, but the ease of use and support are not ideal. From 3.2 Starting from the version, Dubbo will simplify the way for users to access Native Image. It can be mainly divided into three aspects:

  1. Compile plugin configuration upgrade: from the original native-image-maven-plugin to dubbo-maven-plugin +native-maven-plugin, which distinguishes the native image configuration officially provided by Graalvm from the native image configuration required by Dubbo, which simplifies the user The native image configuration that needs to be concerned
  2. In the old version, users need to manually generate and complete the unique Adaptive code in Dubbo, and users of the new version will not need to care about these details.
  3. The configuration file under META-INF.native-image generated by the Dubbo framework in the old version will be directly generated in the user's project directory, and the new version 3.2 will be compiled into the target without affecting the user's project structure. In addition, the Dubbo framework will no longer use the method of manually completing the native image, but will automatically detect and generate the required configuration files, which simplifies the experience of Dubbo developers. This can also reduce the size of the final compiled binary package and improve compilation speed.

In addition to improving ease of use, Dubbo will support API, annotations, and XML configuration methods in native image scenarios in version 3.2, and support compatibility with native in SpringBoot3.

04 other

4.1 JDK 17 & Spring Boot 3 native support

JDK 17 is the latest LTS version of Java after JDK 11, including many new features and improvements, such as Sealed classes, garbage collector improvements, and more.

Since JDK 16 began to restrict Java internal class reflection, Dubbo's serialization and dynamic proxy have been affected to a certain extent. In Dubbo 3.2, we solved the compatibility problem from the bottom through the optimization of Fastjson2 and Javassist. At present, Dubbo can run perfectly on JDK17, and all unit tests and most integration tests have also been tested on the JDK 17 platform.

For the upcoming JDK 21 LTS, Dubbo is intensively adapting it. We will add support for JDK 21 and Dubbo coroutines (Project Loom) in version 3.3.

4.2 RPC performance has been greatly improved

In version 3.2, we have optimized the performance of RPC calls, and the optimized content is as follows.

  1. Eliminates synchronization lock contention and blocking code
  2. Reduced request response latency with synchronous blocking calls
  3. Reduced the number of thread switches
  4. Optimized I/O performance
  5. Support for serializing packets on user threads'

The performance improvement of 3.2 compared with 3.1 is as follows:

  • Triple protocol : In the case of createUser, existUser, and getUser with smaller packets, the improvement rate is about 40-45%, and the improved performance is basically the same as that of gRPC in the same scenario. The large message scenario listUser has increased by about 17%, which is 11% lower than gRPC in the same scenario.
  • Dubbo protocol : The improvement rate is about 180% in the case of createUser and getUser in small message scenarios. The improvement rate of the very small message existUser (only one boolean value) is about 24%, while the improvement rate of the larger message listUser is the highest, reaching 1000%!

insert image description here

insert image description here

How to upgrade to Dubbo 3.2

5.1 Pom Upgrade The latest Dubbo Maven coordinates are:

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

5.2 Compatibility

For the vast majority of users, upgrading to Dubbo 3.2.0 is completely smooth, and only needs to modify the version of the dependent package.

1. Enhancement of serialization verification logic (important)

As mentioned above, in Dubbo 3.2.0 version, Dubbo will enable the strong verification of the serialization whitelist by default to improve the security of Dubbo and avoid the problem of remote command execution. The current mechanism automatically trusts some classes through the package name recursive mechanism, but for some users who use generics and may have incomplete scanning, we recommend that you add -Ddubbo.application.serialize-check-status=WARN configuration. After observing for a period of time (via logs and QoS commands), if no security alarm is triggered, you can configure the strong check mode.

For the configuration of the custom whitelist, you can refer to the documentation on the official website/SDK Manual/Java SDK/Advanced Features and Usage/Improve Security/Class Inspection Mechanism for configuration.

2. Modification of default serialization

Since version 3.2.0 of Dubbo, the default serialization method has been switched from hessian2 to fastjson2. For applications upgraded to 3.2.0, Dubbo will automatically try to use fastjson2 for serialization. Please note that whether it is the client or the server, as long as one end has not been upgraded to 3.2.0, it will be downgraded to hessian2 serialization to ensure compatibility.

3. Push short protection is disabled by default

The purpose of push empty protection is that when the registration center fails and actively pushes empty addresses, Dubbo keeps the last batch of provider information to ensure service availability. However, in most cases, even if the registry fails, empty addresses will not be pushed, only in some special cases. If push short protection is turned on, it will have a great impact on Dubbo's Fallback logic, heartbeat logic, etc., and bring troubles to developers when using Dubbo.

If you need to enable empty protection in the production environment to achieve high availability, you can configure dubbo.application.enable-empty-protection to true. However, please note that it is known that turning on the push-null protection will cause an exception when the server-side application is upgraded from 2.6.x and 2.7.x versions that only support interface-level service discovery to 3.x and then rolled back to the original version. May cause service calls to fail.

06 Summary

Dubbo 3.2 is a very important version, it brings many new features and improvements, making Dubbo more powerful and easy to use. We are very grateful for the support and contributions of the community, and hope that everyone can experience Dubbo 3.2 as soon as possible and enjoy the convenience and advantages it brings.

Click here to enter Dubbo official website

Guess you like

Origin blog.csdn.net/alisystemsoftware/article/details/130333302