Skip to main content

gray-release

Gray Release

CloudBase Cloud Functions supports the multi-version management feature. Through its gray release capability, it can adjust the request traffic ratio between different versions, enabling smooth transition, gray verification, and quick rollback of online services to ensure the stability and security of service releases.

Core Concepts

Version Management

Each cloud function can publish multiple versions. A version is a complete snapshot of the function at a specific moment, including:

  • Function code
  • Configuration information (timeout duration, environment variables, memory specification, etc.)
  • Runtime environment

LATEST Version

The cloud function always has a LATEST version, representing the latest version. When you upload, update, or deploy cloud function code, you are modifying the LATEST version.

Traffic Allocation

You can precisely control the traffic ratio of different versions of cloud functions. CloudBase will automatically distribute request traffic to the corresponding version based on the set ratio.

Consistency Guarantee

CloudBase uses the user's globally unique identifier to ensure request consistency:

  • Requests with user information: All requests from the same user are consistently routed to the same version, ensuring a consistent user experience
  • Requests without user information: Adopts a random scheduling policy for traffic allocation
Example Description

Assume that the LATEST version of the cloud function accounts for 10% of the traffic, and version 1 accounts for 90%. If a user is assigned to version 1, all subsequent requests from that user for this cloud function will be routed to version 1, rather than being randomly assigned by probability.

Gray Release Process

  1. Create a stable version: Publish a new version (e.g., version 1) from the current LATEST version
  2. Switch traffic: Set the LATEST version traffic to 0% and the new version traffic to 100%
  3. Update the code: Deploy new feature code in the LATEST version
  4. Gray Verification: Gradually adjust the traffic ratio of the LATEST version for gray verification

Operation Guide

Create Version

  1. Go to Cloud Functions Management Page
  2. Select the function for which you want to perform gray release
  3. In the [Gray Release Configuration] module, click [Release New Version]

  1. Enter the version description and confirm the release

⚠️ Note: After the version is released, the code and configuration of this version will be locked and cannot be modified again.

Configure Traffic Ratio

On the Gray Release Configuration page, you can adjust the traffic distribution ratio for different versions in real time:

⚠️ Note: Traffic ratio adjustments take effect immediately. Please operate with caution and verify the results promptly.

Best Practices

First Gray Release

For cloud functions that have never used the gray release feature, it is recommended to operate as follows:

  1. Release Baseline Version

    Current status: Only the LATEST version (100% traffic)
    Operation: Release version 1 and set its traffic to 100%
  2. Deploy New Features

    Current status: Version 1 (100% traffic), LATEST (0% traffic)
    Operation: Deploy new feature code in the LATEST version
  3. Start Gray Release

    Set traffic allocation: LATEST (10%), version 1 (90%)
    Result: 10% of users experience new features, while 90% use the stable version.

Version Rollback and Full Release

Rapid Rollback

When issues are detected in the new version, traffic can be rapidly switched back to the stable version:

Emergency rollback: Set stable version traffic to 100%, problematic version traffic to 0%

Full Release

Once the new version passes verification, a full release can be performed:

Full Release: Set new version traffic to 100%, old version traffic to 0%

Gray Release Policy Suggestions

PhaseLATEST TrafficStable Version TrafficDescription
Initial Verification5%95%Verify basic features on a small scale
Expanded Verification20%80%Verify performance and stability
Preparation for Full Release50%50%Large-scale verification
Full Release100%0%Release completed
Suggestion

It is recommended to perform Gray Release during off-peak business hours.

  • Closely monitor key metrics such as error rate and response time for the new version.
  • Prepare a rapid rollback plan to ensure business stability