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
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
Recommended Process
- Standard Gray Release Process
- Hands-on Example
- Create a stable version: Publish a new version (e.g., version 1) from the current
LATESTversion - Switch traffic: Set the
LATESTversion traffic to 0% and the new version traffic to 100% - Update the code: Deploy new feature code in the
LATESTversion - Gray Verification: Gradually adjust the traffic ratio of the
LATESTversion for gray verification
- Release version 1 (Save the current stable code)
- Set version 1 traffic to 100% and
LATESTtraffic to 0% - Deploy new feature code in the
LATESTversion - Set
LATESTtraffic to 10% and version 1 traffic to 90%, starting gray verification. - Adjust the traffic ratio or perform rollback based on the verification results
Operation Guide
Create Version
- Go to Cloud Functions Management Page
- Select the function for which you want to perform gray release
- In the [Gray Release Configuration] module, click [Release New Version]

- 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:
Release Baseline Version
Current status: Only the LATEST version (100% traffic)
Operation: Release version 1 and set its traffic to 100%Deploy New Features
Current status: Version 1 (100% traffic), LATEST (0% traffic)
Operation: Deploy new feature code in the LATEST versionStart 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
| Phase | LATEST Traffic | Stable Version Traffic | Description |
|---|---|---|---|
| Initial Verification | 5% | 95% | Verify basic features on a small scale |
| Expanded Verification | 20% | 80% | Verify performance and stability |
| Preparation for Full Release | 50% | 50% | Large-scale verification |
| Full Release | 100% | 0% | Release completed |
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