Upgrade to Application-Level Service Discovery

This article specifically explains how users can quickly enable the new application-level service discovery feature after upgrading to Dubbo 3, transitioning smoothly from interface-level service discovery to application-level service discovery.

For old Dubbo 2 users, there are two choices when upgrading to Dubbo 3, and the only consideration for the decision is performance.

  1. If your cluster size is not large, and you have not encountered any performance issues such as address pushing while using Dubbo 2, you can continue using interface-level service discovery.
  2. If your cluster size is larger and you have encountered issues such as spike in service discovery load while using Dubbo 2, it is recommended to migrate to the new application-level service discovery.

Based on the above decision-making conclusions, please adjust the following configuration when upgrading the Dubbo 3 framework.

Continue Using Interface-Level Service Discovery

When upgrading to the Dubbo 3 framework, you need to adjust the application configuration as follows (this is just a configuration adjustment, provider applications must be configured, consumer applications are optional):

<dubbo:application name="xxx" register-mode="interface">

or

dubbo:
 application:
   name: xxx
   register-mode: interface #indicates continuing to use the old version service discovery model, optional values are interface, instance, all

Alternatively, the above is a global default configuration, and can be configured separately for each registration center.

<dubbo:registry address="nacos://localhost:8848" register-mode="interface">

or

dubbo:
 registry:
   address: nacos://localhost:8848
   register-mode: interface #indicates continuing to use the old version service discovery model, optional values are interface, instance, all

Enable Application-Level Service Discovery (Default)

For old users, if you want to enable application-level service discovery, a smooth migration process is required. At this point, the newly upgraded Dubbo 3 application needs to perform dual registration and dual subscription (this is the default behavior of the current framework, so users do not need to modify any configuration; the following content will happen automatically. Note: Future versions may switch to single registration and single subscription at the application level) to ensure that both old and new service discovery models can be accommodated.

Provider Registration Behavior

By default, the Dubbo 3 framework will register both interface-level and application-level service discovery addresses simultaneously, allowing both new and old applications in the cluster to discover this application address and initiate calls properly. As shown in the figure below:

dubbo application-level service discovery

Consumer Subscription Behavior

By default, the Dubbo 3 framework has the capability to discover both Dubbo 2 and Dubbo 3 address lists simultaneously. By default, if there are Dubbo 3 addresses available for consumption in the cluster, it will automatically consume Dubbo 3 addresses; if there are no new addresses, it will automatically consume Dubbo 2 addresses (Dubbo 3 provides a switch to control this behavior), as illustrated in the figure below:

dubbo application-level service discovery