金丝雀版本是一种软件开发战略,新版本的 API(以及其他软件)部署作为金丝雀版本用于测试目的,而基础版本仍在相同阶段上部署为生产版本用于正常运营。在本文档中,为了方便讨论,我们将基础版本称为生产版本。虽然这样做是合理的,您也可以随意在任意非生产版本上应用金丝雀版本进行测试。
在金丝雀版本部署中,全部 API 流量按照预配置的比率,随机拆分到生产版本和金丝雀版本中。通常,金丝雀版本接收少量百分比的 API 流量,生产版本接受剩余部分。更新后的 API 功能仅对流经金丝雀版本的 API 流量可见。您可以调整金丝雀版本流量百分比来优化测试覆盖范围或性能。
通过将金丝雀版本流量保持在较小的比例并随机进行选择,大部分用户在任何时间都不会受到新版本中潜在错误的不利影响,而且没有任何一个用户会始终受到不利影响。
在测试指标满足您的要求之后,可以将金丝雀版本提升为生产版本,并在部署中禁用金丝雀版本。这使得新功能在生产阶段中可用。
Canary release is a software development strategy in which a new version of an API (as well as other software) is deployed as a canary release for testing purposes, and the base version remains deployed as a production release for normal operations on the same stage. For purposes of discussion, we refer to the base version as a production release in this documentation. Although this is reasonable, you are free to apply canary release on any non-production version for testing.
In a canary release deployment, total API traffic is separated at random into a production release and a canary release with a pre-configured ratio. Typically, the canary release receives a small percentage of API traffic and the production release takes up the rest. The updated API features are only visible to API traffic through the canary. You can adjust the canary traffic percentage to optimize test coverage or performance.
By keeping canary traffic small and the selection random, most users are not adversely affected at any time by potential bugs in the new version, and no single user is adversely affected all the time.
After the test metrics pass your requirements, you can promote the canary release to the production release and disable the canary from the deployment. This makes the new features available in the production stage.