The author | citizen dubbo – go community source committer | alibaba cloud native public number

The Dubbogo community recently released Dubbogo V1.5.6. This version is aligned with Dubbo 2.7.8, provides command-line tools, and provides multiple ways to load configurations.

There are so many related improvements that this article only lists relevant major features and performance improvements.

1. Command line tool

Those familiar with Dubbo may know that dubbo supports Telnet command-line online debugging.

Dubbo-go’s CLI command line tool is added in this release, which enables users to directly connect to specific services, define transmission structure and data by writing JSON files, initiate calls for online debugging, and print returned data and time consumption.

Nested structs are currently supported, but only request packets and return packets for a single parameter are supported. Data types Only golang basic data types are supported: string, integer, and floating point because they need to be defined in JSON.

The community will post a follow-up article on how this works and how it works. The associated PR is github.com/apache/dubb… Implemented by The youngest apache Committer of Dubbogo, Li Zhixin.

2. Proxy implementation extension

Refactoring the Proxy and adding the ImplementFunc function to allow the project to reimplement the Proxy for the Proxy. If ProxyFactory is used for custom registration, the created proxy. proxy can also customize the implementation and modify the returned data.

The main application scenario is in the gateway generalization call scenario. Those who know will understand.

Related github.com/apache/dubb pr… , written by the author himself.

3. Specify the path of the configuration file during startup

Users using previous versions of Dubbogo joked that it only provided environment variables to load specified configuration files.

export CONF_PROVIDER_FILE_PATH=".. /profiles/dev/server.yml" export CONF_CONSUMER_FILE_PATH=".. /profiles/dev/server.yml" export APP_LOG_CONF_FILE=".. /profiles/dev/log.yml"Copy the code

V1.5.6 provides a new interface for loading configuration files: On the startup command line, set the path of the configuration file using three flags: proConf, conConf, and logConf.

Service Provider:

go run . -proConf .. /profiles/dev/server.yml -logConf .. /profiles/dev/log.ymlCopy the code

Service Consumer:

go run . -conConf .. /profiles/dev/client.yml -logConf .. /profiles/dev/log.ymlCopy the code

Related github.com/apache/dubb pr… “By Chen Jiapeng, a junior at Nanjing University of Information Science and Technology.

4. Customize ServerConfig and ReferenceConfig

The ConfigPostProcessor interface is added. You can use this interface to provide two methods for loading customized configurations when deploying the Dubbogo service.

/ / the provider configuration PostProcessServiceConfig (* common URL) / / service consumer configuration PostProcessReferenceConfig (* common URL)Copy the code

Related github.com/apache/dubb pr… It is realized by Dubbo Chairman Beiwei, who is about to approach 50. Chairman is old and healthy. He calls on everyone to learn from Chairman.

5. Expand URL comparisons

CompareURLEqualFunc is provided in common/url.go, which allows users to customize URL comparison to improve comparison efficiency. See the links below for technical details.

Common/url. Go: https://github.com/apache/dubbo-go/pull/854/files#diff-5111f14762c010c3029a67743796fea97ab1015d35c96670a4cfa25f30145464

The current URL implementation is not in a final state. The common.URL will be split into ServiceConfigURL, ServiceAddressURL, and InstanceAddressURL in a future version of Dubbogo 3.x. Map schemas for the configuration center, registry, and metadata center to minimize change pressure to the lowest granularity.

This function corresponds to pr github.com/apache/dubb… By Ali Double eleven middleware team leader Zhantu students to achieve. Students have been working hard on the programming front line.

Registry optimization

Reuse of ZooKeeper links and optimization of service discovery center logic, greatly reduce the number of TCP links with ZooKeeper, reduce the number of goroutine, reduce the memory usage of Dubbo-Go.

We will apply the same logic to registries such as NACOS, ETCD, Consul, and others, reducing registry stress by reducing the number of Goroutines and reducing consumer and provider memory usage.

This function corresponds to pr github.com/apache/dubb… Now by ant middleware work wang Wenxue students in graffiti work to achieve.

7. Perform the configuration in API format

Previous versions of Dubbogo only provided the option to read configuration from a configuration file. This feature added the configuration as an API, and users could call the relevant API to initialize the configuration.

You can use the API to set related parameters without loading configuration files.

Can reference sample: https://github.com/apache/dubbo-go-samples/tree/master/config-api

Related github.com/apache/dubb pr… It was also realized by Li Zhixin.

8. GRPC optimization

  • Enable the consumer Config timeout in Dubo-go connect_timeout and gRPC server timeout. You can customize the gRPC timeout mechanism.
# connect timeout connect_timeout: "3s" # application config application: organization: "dubbo.io" name: "GreeterGrpcConsumer" Module: "Dubo-go Greeter GRPC client" version: "0.0.1" Environment: "dev"Copy the code
  • Change the mechanism for processing registry service change events to synchronization to prevent errors in the processing sequence of online and offline events caused by frequent service restarts on the Provider end.

  • When the gRPC protocol is used, gRPC services corresponding to all Dubbo-Go services are registered with the gRPC Server and started only after all dubbo-Go services are exposed asynchronously. This fixes the problem that only one service can be registered on the provider.

Overall features from github.com/apache/dubb… Ke Zhan, an engineer from Shanghai Shizhuang Information Technology Co., LTD. (the company where famous APP is located), Yu Yu, the head of DubboGo community, Yun Xing, an engineer from Ali, and Zhang Tian, a student from a company In Nanjing, are jointly responsible for the implementation.

9. Hessian2 go latest feature

In addition to the improvements to Dubo-Go itself, the latest version of the Dubo-Go-Hessian 2 project to date, v1.9.2, also includes the following major improvements:

  • Built-in support java.util.Locale:https://github.com/apache/dubbo-go-hessian2/pull/264
  • Built-in support java.util.UUID:https://github.com/apache/dubbo-go-hessian2/pull/256
  • No support coding pojos object:https://github.com/apache/dubbo-go-hessian2/pull/243
  • Built-in support java.sql.Time:https://github.com/apache/dubbo-go-hessian2/pull/219
  • Built-in support java.sql.Date:https://github.com/apache/dubbo-go-hessian2/pull/221

dubbo-go-hessian2:https://github.com/apache/dubbo-go-hessian2

The overall PR was completed by wang Ge, Li Zhixin, Zhang Yanming and other students in charge of Dubo-Go-Hessian 2 project.

10. Retrospectives and prospects

Dubbogo is currently in a stable and mature state, and version 1.5 will be maintained continuously for BUG fixes and minimal optimizations as necessary.

For more information: https://github.com/apache/dubbo-go/releases/tag/v1.5.6

The latest cloud-native version 3.0 is based on V1.5. x and will be backward compatible with V2.7. x as well as Dubbo 3.0, with the first release scheduled for late April.

If you have any questions, welcome to join the communication group [Group no. 31363295]

Author’s brief introduction

Github ID CityIron, Committer of Dubbo-Go community, mainly involved in dubbo-Go version 1.5 iteration, Dubbo-Go 3.0 service routing and cloud native, and principal of Dubbo-Go-Pixiu project. Currently, I am working in Ali Hema Business Group, engaged in transaction process work. I am good at using Java/Go language, and focus on cloud native and micro services and other technical directions.