All Products
Search
Document Center

Enterprise Distributed Application Service:Configure microservices governance

Last Updated:Nov 28, 2023

Enterprise Distributed Application Service (EDAS) supports a non-intrusive connection to Microservices Engine (MSE). You can implement the microservices governance features provided by MSE on Spring Cloud applications and Dubbo applications in EDAS. When you create or deploy an application, you can configure the service registration and discovery, empty list protection, and graceful start features for the application. This topic describes how to configure microservices governance.

Background information

Service registration and discovery

Eureka, ZooKeeper, and Nacos are popular service registry types in Java microservices models. Service registries are used to implement service registration and discovery. They can decouple services and free you from dependency management. This way, you can dynamically manage microservices.

Empty list protection

This feature applies to the scenario where an exception occurs on a server during service registration. In this scenario, after a client asks a service registry for the server address list (instance list), the service registry returns an empty list. If you enable the empty list protection feature, the client ignores the empty list and obtains the instance list that is normally returned last time from the cache. This ensures that the client is available even when subscriptions from the client are affected by unexpected events. For example, subscriptions may be affected when a service registry updates configurations, performs an upgrade or a downgrade, or encounters an exception such as network disconnection or power outage.

Clients (consumers) subscribe to the instance list that is provided by servers (providers) from a service registry. When a service registry updates configurations, performs an upgrade or a downgrade, or encounters an exception such as network disconnection or power outage, subscriptions from consumers may be affected. As a result, the availability of consumers is degraded. To handle subscription errors that are caused by exceptions, you can enable the empty list protection feature for consumers.

proconfig

Graceful start

For online applications, operations such as release, scale-out, scale-in, and restart are inevitable. EDAS integrates the graceful start solution of MSE to protect applications in the startup phases. This solution provides features such as service prefetching, delayed service registration, and graceful rolling deployment.

  • Service prefetching: allows you to specify the prefetching period and prefetching curve. This reduces the possibility that a newly launched service may fail to bear a traffic spike within a short period.

  • Delayed service registration: forces an application to be registered only after the specified extended period elapses. This ensures that the application is not registered until it is initialized. This way, the application has enough time to process asynchronous requests and prepare computing resources, which prevents errors that occur due to initialization failures.

    If the initialization process of an application is complex, the registration and initialization of the application may be implemented at the same time. The application may have been registered with a registry before the application is completely initialized. In this case, if the application is called by a consumer, an error may be returned. To settle this issue, you can use the delayed service registration feature to enable an application to register with a registry only after the application is completely initialized.

  • Graceful rolling deployment: provides the health check interface for consumers out of a microservices system to check whether an application is ready. This ensures that all consumers can check the application status, no matter whether the consumers stay in or out of a microservices system. This feature supports the checks of both service registration status and service prefetching status.

    Graceful rolling deployment in Kubernetes divides a complete release process into multiple batches. One batch is released each time. After all batches are released, the graceful rolling deployment is complete. EDAS orchestrates the microservices lifecycle and Kubernetes service lifecycle for Kubernetes applications. EDAS provides graceful start capabilities so that applications are registered with a registry and prefetched before the readiness check. This ensures that available instances of an application are running during a graceful rolling deployment.

    • Registration before the readiness check: EDAS provides a feature that aligns the microservices lifecycle with Kubernetes readiness checks. If you enable this feature, you can use EDAS Agent to provide a port for detecting whether an application is registered with a registry. EDAS does not intrude on the application. If EDAS detects that the application is registered, the status code 200 is returned. If EDAS detects that the application is not registered, the status code 500 is returned.

    • Prefetching before the readiness check: EDAS allows you to associate the service prefetching feature with Kubernetes readiness checks. This way, an application is ready only after the services that are enabled for the application are prefetched.

Limits

  • You can enable the empty list protection and graceful start features in a non-intrusive manner only for Spring Cloud applications and Dubbo applications. The following table describes the supported Spring Cloud and Dubbo versions.

    Item

    Empty list protection

    Graceful start

    Spring Cloud

    Spring Cloud Edgware and later

    Spring Cloud Edgware and later

    Dubbo

    Dubbo 2.5.3 to 2.7.8

    Note

    If you want to use the features in Dubbo 3.0 and later, join the DingTalk group (ID: 31723701) to obtain technical support.

    Dubbo 2.7.3 to 2.7.8

    Note

    If you want to use the features in Dubbo 2.6 or Dubbo 3.0 and later, join the DingTalk group (ID: 31723701) to obtain technical support.

  • The Nacos, Eureka, and Zookeeper service registries are supported.

  • In most cases, gateway applications are not called by using registries but are called by exposing APIs. Therefore, the low-traffic prefetching feature provided by MSE is ineffective for gateway applications. In addition, gateway applications have no major changes or complex business logic. Therefore, the service prefetching feature is not mandatory for gateway applications.

  • For applications released in canary mode, you cannot enable the service prefetching feature for the first batch.

Configure microservices governance when you create an application

  1. Log on to the EDAS console. In the left-side navigation pane, choose Application Management > Applications. The Applications page appears. In the top navigation bar, select a region. In the upper part of the page, select a namespace. In the upper-left corner, click Create Application.

  2. In the Basic Information step, set the Cluster Type and Application Runtime Environment parameters and then click Next. The following table describes the parameters.

    Parameter

    Description

    Cluster Type

    The type of the cluster in which you want to deploy the application. Select Kubernetes Clusters.

    Application Runtime Environment

    The application runtime environment. Select an application runtime environment based on the type of the hosted application.

    • Java

      • Custom: Select this option if you want to use a custom image to deploy the application in a Container Service for Kubernetes (ACK) cluster.

      • Java: Select this option if you want to use a universal JAR package to deploy the application as a Dubbo or a Spring Boot application. You can set the Java Environment parameter after you select this option.

      • Tomcat: Select this option if you want to use a universal WAR package to deploy the application as a Dubbo or a Spring application. You can set the Java Environment and Container Version parameters after you select this option.

      • EDAS-Container (HSF): Select this option if you want to use a WAR or FatJar package to deploy the application as a High-speed Service Framework (HSF) application. You can set the Java Environment, Pandora Version, and Ali-Tomcat Version parameters after you select this option.

    • PHP: Select this option if the application is a PHP application that runs on Apache HTTP Server.

    • Node.js, C++, Go, and Other Languages: Select this option if you want to use a custom image to deploy the application in a Kubernetes cluster. The configuration process for multi-language applications is not described in this topic.

    Note
    • If you select EDAS-Container (HSF) in the Select Application section, you can enable only the service registration and discovery feature for the application.

    • If you select PHP or Node.js, C++, Go, and Other Languages in the Hosted Applications section, you cannot configure microservices governance for the application.

  3. In the Configurations step, configure the environment information, basic information, and deployment method for the application, set the related resource parameters, and then click Next.

  4. In the Advanced Settings step, click Microservices Governance. Then, you can configure the service registration and discovery, empty list protection, and graceful start features based on your business requirements.

    Parameter

    Description

    Service Registration and Discovery

    The O&M method for your service registry. You can select the shared service registry of EDAS or the service registry configured for the application. For more information, see Select an O&M method for your service registry.

    Empty List Protection

    Specifies whether to enable the empty list protection feature.

    • If you enable empty list protection, the subscriptions to empty instance lists by consumers are ignored. This ensures high service availability.

    • If you disable empty list protection, your business is interrupted and an error is returned when a consumer subscribes to an empty instance list.

    Graceful Release

    Specifies whether to enable the graceful start feature. To enable this feature, set the following parameters:

    • Prefetching Duration (Seconds): the period of time that is required for service prefetching at the next startup of an application instance. The default value is 120. Valid values: 0 to 86400. The value 86400 equals 24 hours.

    • Number of Prefetching Curves: In a configured prefetching duration, the traffic weight for the prefetched application exponentially grows with the curve value. In a specified prefetching duration, if the curve value is large, the traffic weight for the prefetched application is small when the application is initialized. This ensures that complex applications have enough time for prefetching.

      The default value is 2, which is suitable for common prefetching scenarios. This value indicates that the received traffic of the provider during prefetching is displayed as a quadratic curve. Valid values: 0 to 20. For the same prefetching duration, a larger value of this parameter indicates that the service provider receives a smaller amount of traffic when service prefetching starts and the amount of the received traffic gradually increases until the prefetching is complete.

    • Registration Delay (Seconds): Set this parameter to a value that ranges from 0 to 86400. The value 86400 equals 24 hours.

    • Graceful Rolling Release: Specify whether to enable the graceful rolling deployment feature.

      • Complete Service Registration before Readiness Probing: provides port 55199 for the application to check whether the services are registered. If yes, the status code 200 is returned. Otherwise, the status code 500 is returned.

      • Complete Service Prefetching before Readiness Probing: provides port 55199 for the application to check whether the services are prefetched. If yes, the status code 200 is returned. Otherwise, the status code 500 is returned.

        Note

        If you turn on both Complete Service Registration before Readiness Probing and Complete Service Prefetching before Readiness Probing, port 55199 is provided to check whether the services are prefetched.

  5. In the Advanced Settings step, click Application Life Cycle Management. Set the Readiness parameter options and turn on the switch for the configuration of the readiness probe to take effect.

    serviceLifecycle

    If you do not configure a readiness probe for the application, after you enable the graceful rolling deployment feature, the option of graceful rolling deployment mode is available for the Select a mode parameter. If you select the graceful rolling deployment mode, the system uses the /health path as the default path for the application and provides port 55199 for the readiness check. You can use the graceful rolling deployment mode to orchestrate the microservices lifecycle and Kubernetes service lifecycle for Kubernetes applications. Alternatively, you can use other modes together with the health check interface to check the readiness based on your business requirements.

  6. Click Create Application.

  7. On the Creation Completed page, check the information in the Basic Information, Configurations, and Advanced Settings sections. Then, click Create Application.

    In the upper part of the Application Overview page, click View Details. On the Change List page, view the application change process. Wait several minutes until the application is deployed. After the application change process is complete, view the status of the instance in the Basic Information section of the Application Overview page. If the status shows that a pod is running, the application is deployed.

Configure microservices governance when you update an application

If you did not enable the service registration and discovery, empty list protection, and graceful start features when you created an application, you can enable them when you deploy the application.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, click Application Management > Applications. In the top navigation bar, select a region. In the upper part of the page, select a namespace. Select Container Service or Serverless Kubernetes Cluster from the Cluster Type drop-down list. Then, find the application that you want to deploy and click the application name.

  3. On the Overview or Basic information page, choose Deploy > Deploy in the upper-right corner.

  4. On the Select Deployment Mode page, select a deployment mode and click Start Deployment in the upper-right corner of the specified deployment mode section.

  5. Set the runtime environment and deployment package for the application, and click Configuration Management. After the configuration is complete, click OK.

    1. Unfold Microservices Governance and configure the service registration and discovery, empty list protection, and graceful start features based on your business requirements.

      Parameter

      Description

      Service Registration and Discovery

      The O&M method for your service registry. You can select the shared service registry of EDAS or the service registry configured for the application. For more information, see Select an O&M method for your service registry.

      Empty List Protection

      Specifies whether to enable the empty list protection feature.

      • If you enable empty list protection, the subscriptions to empty instance lists by consumers are ignored. This ensures high service availability.

      • If you disable empty list protection, your business is interrupted and an error is returned when a consumer subscribes to an empty instance list.

      Graceful Release

      Specifies whether to enable the graceful start feature. To enable this feature, set the following parameters:

      • Prefetching Duration (Seconds): the period of time that is required for service prefetching at the next startup of an application instance. The default value is 120. Valid values: 0 to 86400. The value 86400 equals 24 hours.

      • Number of Prefetching Curves: In a configured prefetching duration, the traffic weight for the prefetched application exponentially grows with the curve value. In a specified prefetching duration, if the curve value is large, the traffic weight for the prefetched application is small when the application is initialized. This ensures that complex applications have enough time for prefetching.

        The default value is 2, which is suitable for common prefetching scenarios. This value indicates that the received traffic of the provider during prefetching is displayed as a quadratic curve. Valid values: 0 to 20. For the same prefetching duration, a larger value of this parameter indicates that the service provider receives a smaller amount of traffic when service prefetching starts and the amount of the received traffic gradually increases until the prefetching is complete.

      • Registration Delay (Seconds): Set this parameter to a value that ranges from 0 to 86400. The value 86400 equals 24 hours.

      • Graceful Rolling Release: Specify whether to enable the graceful rolling deployment feature.

        • Complete Service Registration before Readiness Probing: provides port 55199 for the application to check whether the services are registered. If yes, the status code 200 is returned. Otherwise, the status code 500 is returned.

        • Complete Service Prefetching before Readiness Probing: provides port 55199 for the application to check whether the services are prefetched. If yes, the status code 200 is returned. Otherwise, the status code 500 is returned.

          Note

          If you turn on both Complete Service Registration before Readiness Probing and Complete Service Prefetching before Readiness Probing, port 55199 is provided to check whether the services are prefetched.

    2. Unfold Throttling and Degradation Configuration and turn on Access AHAS.

    Important

    The application is restarted after you click OK. We recommend that you configure these features during off-peak hours.

Verify the result

In the left-side navigation pane of the application details page, click Change List to view the change details of the application. If the execution of the current change is successful, the application is deployed and the configurations are in effect.