Canary release
CloudBase cloud function supports multi-version management. With the canary release capability, it can adjust the request traffic ratio between different versions, achieving smooth transition of online services, canary verification, and quick rollback, ensuring 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 point in time, including:
- Function code
- Configuration information (timeout period, environment variables, memory specifications, etc.)
- Runtime environment
LATEST version
Cloud functions always have a LATEST version, which represents the most recent version. When you upload, update, or deploy cloud function code, you are modifying the LATEST version.
Traffic Distribution
You can precisely control the traffic ratio for different versions of cloud functions. CloudBase automatically distributes request traffic to corresponding versions 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: Traffic is allocated using a random scheduling policy
Assume that the LATEST version of the cloud function has a traffic ratio of 10%, and version 1 has 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 allocated based on probability.
Canary release process
Recommended process
- Standard Canary Release Process
- Practical Operation Example
- Creating a stable version: Publish a new version (e.g., version 1) from the current
LATESTversion - Switching traffic: Set the
LATESTversion traffic to 0% and the new version traffic to 100% - Updating the code: Deploy new feature code in the
LATESTversion - Canary verification: Gradually adjust the traffic ratio of the
LATESTversion for canary testing
- 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 the
LATESTtraffic to 10% and version 1 traffic to 90% to start canary testing - Adjust the traffic ratio or perform a rollback based on the verification results
Operation Guide
Create Version
- Go to the Cloud Function Management Page
- Select the function that requires canary release
- In the Canary Configuration module, click Release a 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 Canary Configuration page, you can dynamically adjust the traffic allocation ratio for different versions in real time:
⚠️ Note: Traffic ratio adjustments take effect immediately. Proceed with caution and verify the results promptly.
Best Practices
First Canary Release
For cloud functions that have never used the canary release feature, it is recommended to follow these steps:
Release the baseline version
Current status: Only the LATEST version (100% traffic)
Operation: Release version 1 and set its traffic to 100%.Deploy the new feature
Current status: version 1 (100% traffic), LATEST (0% traffic)
Operation: Deploy the new feature code in the LATEST versionStart the Canary Release
Set traffic allocation: LATEST (10%), version 1 (90%)
Result: 10% of users experience the new feature, 90% of users use the stable version
Version Rollback and Full Release
Rapid Rollback
When issues are detected in the new version, you can quickly switch traffic back to the stable version:
Emergency Rollback: Set stable version traffic to 100%, problematic version traffic to 0%
Full Release
When the new version passes verification, you can proceed with the full release:
Full Release: Set new version traffic to 100%, old version traffic to 0%
Canary Policy Recommendations
| Stage | LATEST Traffic | Stable Version Traffic | Description |
|---|---|---|---|
| Initial Verification | 5% | 95% | Verify basic features in a small-scale |
| Expanded Verification | 20% | 80% | Verify performance and stability |
| Pre-Full Release | 50% | 50% | Large-scale verification |
| Full Release | 100% | 0% | Release completed |
- Recommend performing canary releases during off-peak business hours
- Closely monitor key metrics of the new version, such as error rate and response time
- Prepare a quick rollback plan to ensure business stability