โ† Back to microservices patterns map
๐Ÿ”ต๐ŸŸข
Microservices Pattern

Blue-Green Deployment

Run two identical environments and switch traffic after the new one passes checks.

deploy

Detailed Description

Blue-green deployment minimizes downtime by preparing the new version before traffic moves.

It is strongest when database migrations are backward compatible.

Use expand-contract migrations: expand schema first, deploy, backfill, then remove old fields in a later release.

Keep Blue warm for a rollback window and use load balancer draining so in-flight requests complete safely.

Store sessions in shared infrastructure (for example Redis) so auth/session continuity survives traffic flips.

Visual Diagram

Blue = live v1
Green = deploy v2
Test green
Switch traffic to green
Blue becomes rollback

Tradeoffs

Pros

Fast rollback and clean release boundary

Cons

Requires duplicate capacity

Examples: AWS CodeDeploy, Kubernetes service switching