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

Using Dark Launch

In dark launch, a small number of users test the trial version, ensuring the smooth rollout of new features. Once new features become mature, a formal version is released for all users. Dark launch ensures stability of the entire system. During initial dark launch, problems can be detected and fixed.

For ServiceComb Java chassis and Spring Cloud Huawei microservices registered with the ServiceComb engines, deliver configurations to use dark launch.

If ServiceComb Java chassis depends on handler-router and Spring Cloud Huawei depends on spring-cloud-starter-huawei-router to implement microservice dark launch, the delivery rules comply with the following specifications:

servicecomb:
    routeRule:  
      provider: | #Service name.
      - precedence: 2 #Priority.
          match:        #Matching policy.
            headers:          #Header matching.
              region:            
                exact: 'providerRegion'

              type:         
                exact: gray
           route: #Routing rule.
            - weight: 100 #Weight value.
              tags:
                version: 1.0.0
              
        - precedence: 1
          route:
            - weight: 20
              tags:
                version: 0.0.1
                canaryProperty: group-a
            - weight: 80
              tags:
                version: 0.0.2

The preceding configurations are described as follows:

  • match specifies the requests to be matched. The matching condition is headers. Fields in headers support exact match. If match is not defined, any request can be matched.
  • The forwarding weight is defined in routeRule.{targetServiceName}.route and is configured by weight. The value of weight indicates the percentage. The sum of the values must be equal to 100. If the sum is smaller than 100, the value in the latest version is calculated.
  • The service group is defined under routeRule.{targetServiceName}.route and is configured by tags. version is a special tag, indicating the microservice version. You can also configure other properties, which are defined in the properties of the instance.
  • A larger priority value indicates a higher priority.

If ServiceComb Java chassis depends on darklaunch to implement microservice dark launch, the rules are also delivered on the ServiceComb engine page and comply with the following specifications:

{
  "policyType":"RULE",
  "ruleItems":[
    {
      "groupName":"self_rule_test",
      "groupCondition":"version=0.0.1",
      "policyCondition":"name=11111",
      "versions":["0.0.1"]
     }],
   "empty":false
}

The preceding configurations are described as follows:

  • policyCondition: matching condition of the routing rule. This rule matches the request parameter name. When the value is 11111, the current routing rule is matched.
  • groupName: name of the routing rule.
  • groupCondition: target group of the rule. When name=11111 is matched, the route is routed to the microservice instance with version=0.0.1.
  • The configuration item is fixed to cse.darklaunch.policy.${serviceName}.

Spring Cloud Huawei

When Spring Cloud Huawei uses the dark launch, you need to add the following dependencies to the project. If the dependencies have been directly or indirectly included in the project, you do not need to add them.

<dependency>
  <groupId>com.huaweicloud</groupId>
  <artifactId>spring-cloud-starter-huawei-router</artifactId>
</dependency>

Set the headers parameter on which the dark launch rule depends.

  • In 1.10.7 and later versions, set the header parameter in the configuration file. The header in the user request is not transparently transmitted to the downstream service.
    spring:
      cloud:
        servicecomb:
          context:
            headerContextMapper:
              canary: canary
  • In versions earlier than 1.10.7, the header parameters set in the request are transparently transmitted.

Java Chassis

When Java chassis uses dark launch, you need to add the following dependencies to the project. If the dependencies have been directly or indirectly included in the project, you do not need to add them.

<dependency>
  <groupId>org.apache.servicecomb</groupId>
  <artifactId>handler-router</artifactId>
</dependency>

or

<dependency>
    <groupId>org.apache.servicecomb</groupId>
    <artifactId>darklaunch</artifactId>
</dependency>

Add the following configuration item to the configuration file:

servicecomb.router.type: router

By default, Java chassis does not transfer non-parameter headers to microservices. If dark launch depends on non-parameter headers, you can add the following configuration items:

servicecomb.router.header: canaryHeader1,canaryHeader2

Java chassis uses these non-parameter headers for dark launch matching.

If the request is forwarded by EdgeService, you also need to add configurations related to dark launch to EdgeService.