DevOps
Blue-Green Deployment
Run two identical production environments; deploy to the idle one (green), test it, then switch all traffic from blue to green at once — giving instant rollback by flipping straight back. It removes deploy downtime and risk. The cost is double the infrastructure and handling database migrations that must serve both versions during the switch.
Purpose
Blue-green deployment maintains two identical production environments: blue serves live traffic while the new version deploys to idle green, where it can be smoke-tested against production infrastructure. The router then flips all traffic to green in one motion — with instant rollback by flipping back.
When to Use It
Releases where a mistake must be reversible in seconds, and deploy windows where downtime is unacceptable. It also gives a full-fidelity staging check — the environment being tested is production hardware, one router flip away.
Trade-offs
You run two production environments, doubling infrastructure cost (mitigated in the cloud by spinning green up on demand). The hard part is the database: one schema must serve both versions during the transition, which forces backward-compatible, expand-then-contract migrations.
Implementation
Automate the flip at the load balancer or DNS layer, keep sessions external so a flip does not log users out, and script the rollback path as thoroughly as the deploy. Sequence schema changes: add new columns first, deploy code that handles both, remove old columns later.