Releasing a new version is not “push to all” — each of the four strategies has trade-offs. This is Blue/Green / Canary / Feature Flag / A/B test architecture, traffic shift mechanism, rollback plans, plus Feature Flag, Argo Rollouts, LaunchDarkly tools in practice.
actor "Users" as Users participant "Load Balancer" as LB participant "Blue Env\n(v1.0)" as Blue participant "Green Env\n(v2.0)" as Green database "Blue DB" as BlueDB database "Green DB" as GreenDB
== Deploy v2.0 to Green == Users -> LB : ① 100% traffic LB -> Blue : ② route to Blue Blue -> BlueDB : ③ read v1.0 BlueDB --> Blue : ④ data
note over Green deploy v2.0 to Green no traffic internal testing end note
Green -> GreenDB : ⑤ data migration / dual-write test
note over LB : switch traffic LB -> Green : ⑥ 100% traffic to Green Green -> GreenDB : ⑦ read v2.0
== Rollback (seconds) == LB -> Blue : ⑧ one second back to Blue (emergency)
note right of LB DNS / nginx upstream / k8s service selector one line to switch end note
@enduml
Blue/Green key points:
two complete environments — resources × 2
shared database — both versions compatible with same schema
@startuml title "Canary Deployment - Gradual Rollout"
actor "Users" as Users participant "Load Balancer\n(istio / nginx)" as LB participant "v1.0 (95% traffic)" as V1 participant "v2.0 (5% traffic)" as V2 database "DB" as DB
== Step 1: 1% canary == Users -> LB : ① 1000 users access LB -> V2 : ② 1% → 10 users to v2.0 LB -> V1 : ③ 99% → 990 users to v1.0
note over V2 monitor v2.0: - error rate < 1%? - p99 latency < 500ms? - CPU normal? end note
V2 -> DB : ④ read/write V1 -> DB : ④ read/write DB --> V2 : ⑤ data DB --> V1 : ⑤ data
note right of FF rule: - User A,B → enabled - User C → disabled - gradual 50% end note
Config --> FF : ⑥ rule
FF --> App : ⑦ User A: enabled FF --> App : ⑧ User B: enabled FF --> App : ⑨ User C: disabled
App -> App : ⑩ User A goes through new checkout (v2 code path) App -> App : ⑪ User B goes through new checkout App -> App : ⑫ User C goes through old checkout (v1)
@enduml
Feature Flag types:
Boolean flag — fully on / fully off
user whitelist — internal employees / beta users
percentage rollout — 50% of users
by attribute — country / device / subscription tier
if (is DB schema change compatible) if (compatible) :continue; else :do schema migration first (expand-migrate-contract); end end
:new feature vs perf fix?;
if (new feature) if (user scope) if (internal test) :Feature Flag (whitelist); else if (5% rollout) :Feature Flag (5%); else if (full) :Feature Flag (100%) + direct deploy; end end else if (high-risk change) :Blue/Green (test full traffic); else :Canary (1% → 5% → 25% → 100%); end end
if (error rate > 5%) :immediate rollback (Blue/Green switch back); stop elseif (error rate 1-5%) :pause rollout; if (recover in 10 min) :continue; else :rollback; end elseif (error rate < 1% but latency high) :check upstream dependency issue; if (upstream issue) :continue after upstream recovers; else :pause or rollback; end elseif (business metric anomaly) :check if experimental group issue; if (new version introduced) :Feature Flag off; else :no rollback; end end
Canary pod doesn’t get traffic — Istio VirtualService not configured. canaryService / stableService both needed.
Feature flag not cleaned — 100% on, flag still in code. Periodic audit + tool enforce cleanup.
A/B test insufficient samples — small traffic, not significant. Use power analysis for minimum sample size.
Rollback too slow — Canary manual each step. Use Argo Rollouts auto-rollback.
Rollback causes data inconsistency — v2.0 wrote data, v1.0 can’t read new field. Dual-write compatibility period.
Monitoring blind spot — only HTTP status codes, not business errors. Business events + error aggregation.
Feature Flag service down — entire app flag-loading timeout. Fallback to default + local cache.
Decision tree
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
What to deploy? ├─ New version full release → Blue/Green (high-risk) / Canary (standard) ├─ New feature gradual → Feature Flag ├─ Experiment validation → A/B test └─ Emergency fix → Blue/Green + immediate switch
Risk level? ├─ Low (frontend only / perf optimization) → Feature Flag direct enable ├─ Medium (backend logic) → Canary └─ High (DB migration / architecture change) → Blue/Green + full test
Rollback requirement? ├─ Seconds → Blue/Green ├─ Minutes → Canary + automation └─ Rollback can be deferred → Feature Flag (cleanup in next release)
Remember: no zero-risk deploy, only low-risk deploy + fast rollback. Monitoring + automation + data compatibility are three cores. Watch monitoring 2 hours after deployment day, don’t just push and leave.