All Products
Search
Document Center

Enterprise Distributed Application Service:Configure a service degradation rule for a Dubbo application

Last Updated:Nov 15, 2023

During peak hours, a downstream service provider may experience a performance bottleneck that even affects your business. In this case, you can use the service degradation feature to degrade some service consumers. Unimportant service consumers do not call the services provided by the provider. Instead, degraded responses are directly returned. Valuable resources of the downstream service provider are reserved for key service consumers. This way, the overall service stability is improved.

Background information

Existing open source circuit breakers, such as Sentinel and Hystrix, break the circuits for unstable calls to services with weak dependencies. This protects against overall system failures caused by unstable calls. Circuit breaking is a self-protective feature that is configured on service consumers in most cases.

The service degradation feature can be enabled regardless of whether a service call is normal. This feature protects service providers and ensures that resources are preferentially allocated to key service consumers.

The following example shows how to use service degradation in Dubbo applications.

  • Service degradation rules are not configured.

    By default, Consumers 1, 2, and 3 call instances of CartService by using getProviderIp, viewCart, and addItemToCart.

    The following figure shows the call relationship when service degradation rules are not configured.

    Service degradation rules are configured
  • Service degradation rules are configured.

    A degradation rule is configured to be used when Consumer 1 calls an instance of CartService by using getProviderIp. When you configure the service degradation rule, you select Return Custom Json Data from the Degradation Policy drop-down list and select All Requests for Effective Policy. After this rule is configured, if Consumer 1 wants to call an instance of CartService by using getProviderIp, Consumer 1 triggers a local service degradation based on the configured rule.

    The following figure shows the call relationship after a service degradation rule is configured.

    Service degradation rules are configured

Create a service degradation rule

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Traffic Management > Microservices Governance > Dubbo.

  3. In the navigation tree of the Dubbo page, click Service Degradation.

  4. In the top navigation bar, select a region. On the Service Degradation page, select microservices namespace. Then, click Create Service Degradation Rule.

  5. In the Create Service Degradation Rule panel, set the parameters and click OK.

    Create a service degradation rule for a Dubbo application

    The following table describes the parameters.

    Parameter

    Description

    Microservice Space

    Select the region and microservice namespace where the application resides.

    Rule Name

    Enter a name for the service degradation rule. The name can be up to 64 characters in length, and can contain letters, digits, underscores (_), and hyphens (-).

    Description

    Enter a description for the service degradation rule.

    Service Provider Application

    Select the application that can be called by other applications.

    Degradation Consumer Application

    Select an application that you want to degrade.

    Service Degradation Rules

    Click Add Service Degradation Rule to add a service degradation rule.

    Framework Type

    Select Dubbo.

    Service method

    Select the application that you select from the Service Provider Application drop-down list and select the interface that is used to call the application.

    Effective strategy

    Select the policy based on which the service degradation rule takes effect. Valid values: All Requests and Effective for Requests That Trigger Exceptions.

    Degradation Policy

    Select the policy for the service degradation rule. If the rule is triggered, the specified content is returned. Valid values: Return Null Value, An exception returned, and Return Custom Json Data.

    Use Default Values

    Turn on or off the switch to enable or disable the rule.

    • On: enables the rule after it is created. By default, the switch is turned on.

    • Off: disables the rule after it is created. To enable the rule, find the rule on the Service Degradation page and click Enable in the Operation column.

Result

After you create and enable the service degradation rule, check whether the rule takes effect based on your business requirements.

What to do next

After you create the service degradation rule, you can edit the rule. You can also disable or enable the rule based on the status of the rule. If you no longer require the rule, you can delete the rule.