All Products
Search
Document Center

Serverless App Engine:Smoothly migrate Dubbo applications to SAE

Last Updated:Aug 23, 2023

If your Dubbo application is deployed on Alibaba Cloud, you can migrate the application to Serverless App Engine (SAE). This topic describes how to smoothly migrate applications to SAE.

Background information

Application migration overview

Step 1: Migrate the first application

This section provides an example on how to smoothly migrate a demo application to SAE. For information about the download URL of the demo application, see Demo.

  1. Assign the priorities of the application that you want to migrate to SAE.

    Select an application with a high priority for migration. We recommend that you start migration from underlying providers. If the trace is complex and difficult to analyze, you can migrate a random application.

  2. Add dependencies to the application and modify the application configurations.

    Note

    In this example, the dual-registration and dual-subscription migration solution is used to migrate applications.

    1. Add the edas-dubbo-migration-bom dependency to the pom.xml file.

      <dependency>
          <groupId>com.alibaba.edas</groupId>
          <artifactId>edas-dubbo-migration-bom</artifactId>
          <version>2.6.5.1</version>
          <type>pom</type>
      </dependency>                            
    2. Add the IP address of an SAE registry to application.properties.

      dubbo.registry.address = edas-migration://192.168.XX.XX:9999?service-registry=edas://127.0.XX.XX:8080,zookeeper://192.168.XX.XX:2181&reference-registry=zookeeper://192.168.XX.XX:2181&config-address=127.0.XX.XX:8848      
      Important

      If an application is not a Spring Boot application, specify registry addresses in dubbo.properties or the Spring configuration file.

      Parameter

      Description

      edas-migration://192.168.XX.XX:9999

      The header of the registry address. If the application is registered with multiple service registries, you do not need to modify the header. If the log level is WARN or lower, a WARN log may be thrown during startup because Dubbo verifies the IP address and port. The log can be ignored.

      service-registry

      The registry address for service registration. You can specify multiple registry addresses. Each registry address is in the standard format of a Dubbo registry address. Separate multiple registry addresses with commas (,). In this example, 192.168.XX.XX indicates the ZooKeeper address. Specify an IP address and port based on your business scenario.

      reference-registry

      The registry address for service subscription. You can specify multiple registry addresses. You can also specify the address of the original registry before migration.

      config-address

      The dynamically pushed address.

    3. Complete other modifications.

      If an application is not a Spring application of Spring Boot, add com.alibaba.edas.dubbo.migration.controller.EdasDubboRegistryRest to the scan path.

  3. Verify the result in your on-premises environment.

    In this example, dynamic configuration is used.

    1. Complete preparations before verification. Before you verify the result, perform the following operations:

    2. Check whether the service is registered.

      • Log on to the lightweight configuration center to view the service in the service provider list.

      • Log on to ZooKeeper to view the information about service registration and consumption.

    3. Optional:Log on to Nacos to configure the service registration information.

      Note

      If dynamic configuration is not required, skip this step.

      Parameter

      Description

      DataId

      Set this parameter to dubbo.registry.config.

      Group

      Set this parameter to the Dubbo application name that is specified by the applicationName parameter. Example: dubbo-migration-demo-server. The application name must be unique because the service registration information is configured at the application level.

      Configuration Content

      • Application level

        dubbo.reference.registry=edas://127.0.XX.XX:8080   # The registry address for service registration. 
        dubbo.service.registry=edas://127.0.XX.XX:8080,zookeeper:127.0.XX.XX:2181   # The registry address for service subscription. 
      • Instance IP address level

        192.168.15.86.dubbo.reference.registry=edas://127.0.XX.XX:8080,zookeeper:127.0.XX.XX:2181
        192.168.15.86.dubbo.service.registry=edas://127.0.XX.XX:8080                                               

      When you validate a cluster, we recommend that you first check whether the configurations at the instance IP address level take effect. Then, check the configurations at the application level.

    4. Check whether the application call is normal after migration and check the registration and subscription relationships of service registries.

      • Spring Boot 1.x: http://ip:port/dubboRegistry

      • Spring Boot 2.x: http://ip:port/actuator/dubboRegistry

      Dubbo application migration 1
  4. Deploy the application on SAE.

    Deploy the application on SAE based on your business scenario.

  5. Verify the result.

    1. Check whether your business runs as expected.

    2. View the monitoring data of service subscription.

      If Spring Boot Actuator is enabled for the application, you can access Actuator to view the information about RibbonServerList of each service to which the application subscribes. You can access Actuator by using the following URLs:

      • Spring Boot 1.x: http://ip:port/dubboRegistry

      • Spring Boot 2.x: http://ip:port/actuator/dubboRegistry

      Dubbo application migration 2
      • dubbo.orig.**: the service registry information that is configured in the application.

      • dubbo.orig.**: the service registry information that takes effect in the application.

Step 2: Migrate other applications

Migrate all applications to SAE in sequence. For more information, see Step 1: Migrate the first application.

Step 3: Delete migration configurations

After migration, delete the original service registry configurations and the edas-dubbo-migration-bom dependency that is used during migration.

Modify the registry address by deleting the ZooKeeper configurations. This ensures that consumers subscribe to registry addresses only from SAE and providers offer subscriptions only in SAE. You can modify the registry address by using the following methods:

  • Method 1: Dynamic configuration. For more information, see Verify the result in your on-premises environment.

  • Method 2: Manual modification.

    Change the registry address to the address of SAE Config Server after all applications are modified.

    dubbo.registry.address = edas-migration://192.168.XX.XX:9999?service-registry=edas://127.0.XX.XX:8080,zookeeper://192.168.XX.XX:2181&reference-registry=edas://127.0.XX.XX:8080&config-address=127.0.XX.XX:8848

    Change the value of reference-registry from zookeeper://192.168.20.219:2181 to edas://127.0.XX.XX:8080. Then, deploy applications.

    dubbo.registry.address = edas://127.0.XX.XX:8080                        
    Note

    Delete zookeeper://172.31.XX.XX:2181 from the service registry configurations if ZooKeeper is no longer required after migration.

    From the long-term perspective, ZooKeeper has no impact on service stability but increases the complexity and the error rate of using service registries in Dubbo. We recommend that you clear the ZooKeeper configurations after migration and restart applications in batches during off-peak hours. The following sample code shows the final registry address.

    dubbo.registry.address = edas://127.0.XX.XX:8080