--- title: "Canary Release" type: concept tags: [devops, deployment, release-management, automation] date: 2025-03-01 --- ## Definition 金丝雀发布(Canary Release)是一种渐进式软件发布策略,将新版本首先部署给小部分用户,验证稳定性后再逐步扩大范围,最终替换全部用户。这种策略降低了全量发布风险,实现近乎零干扰的发布。 ## How It Works ``` Phase 1: 5% Traffic Phase 2: 20% Traffic Phase 3: 100% Traffic ┌─────────────────┐ ┌─────────────────┐ ┌─────────────────┐ │ New Version │ │ New Version │ │ Old Version │ │ ██ │ │ ████ │ │ ░░░░ │ │ 5% users │ │ 20% users │ │ Rollback if │ └─────────────────┘ └─────────────────┘ │ issues │ ↓ ↓ └─────────────────┘ Monitor metrics Monitor + Auto-rollback ↓ Auto-promote if failure rate ↑ Full Deployment ``` ## Key Metrics to Monitor | 指标 | 描述 | 告警阈值 | |------|------|---------| | Error Rate | 错误率变化 | +2% | | Latency | 响应时间 | +50ms | | Business KPIs | 转化率、订单量 | -5% | | Resource Usage | CPU/内存 | +30% | ## In ITSM Context 在[[ITSM 2.0]]的[[Release-Management]]中,金丝雀发布是关键实践: ``` Release Management 2.0 ├── Canary Release │ ├── 渐进式流量转移 │ ├── 实时监控 │ └── 自动回滚 ├── Blue-Green Deployment │ ├── 零停机切换 │ └── 快速回滚 └── Feature Flags ├── 精细化控制 └── A/B Testing ``` ## Related Concepts - [[Release-Management]] — 发布管理总框架 - [[Blue-Green-Deployment]] — 蓝绿部署 - [[Feature-Flag]] — 特性开关 - [[Progressive-Rollout]] — 渐进式发布 - [[Deployment-Automation]] — 部署自动化 ## Sources - [[understanding-complete-itsm]] — Canary Release在现代ITSM中的应用