Updated on 2024-05-06 GMT+08:00

Service Degradation

During peak hours, access to the target service needs to be temporarily reduced to decrease the load of the target service. Alternatively, access to non-key services needs to be shielded to maintain the core processing capability of the service.

  • Service degradation of Java chassis is used for microservice consumers. The service degradation module must be integrated into microservice applications and the bizkeeper-consumer processing chain must be enabled.

    Configuration example:

    servicecomb:
      handler:
        chain:
          Consumer:
            default: bizkeeper-consumer

    Add the following dependency to the POM file:

    <dependency>
       <groupId>org.apache.servicecomb</groupId>
       <artifactId>handler-bizkeeper</artifactId>
       <version>${project.version}</version>
    </dependency>

    The microservice development framework Java Chassis 2.x is used as an example.

  • Spring Cloud Huawei degradation is a governance rule. After Spring Cloud Huawei is integrated, the client governance module spring-cloud-starter-huawei-governance is integrated by default. The principles are as follows: When the traffic target path is requested, null is returned for all requests. forceClosed is a parameter for forcibly disabling degradation governance. When forceClosed is set to true, degradation governance is forcibly disabled. The default value is false.

    Configuration example:

    servicecomb:  
      matchGroup:     
        demo-test-fallback: |     
          matches:      
            - serviceName: "MyMicroservice"        
              apiPath:         
                prefix: "/"
      faultInjection:     
        demo-test-fallback: |      
          type: abort      
          percentage: 100      
          fallbackType: ReturnNull      
          forceClosed: false

    When the preceding configuration is enabled, requests for accessing any API of MyMicroservice will be blocked and FaultInjectionException with error code 500 will be returned.