โ Back to microservices patterns mapdeploy
๐ต๐ข
Microservices Pattern
Blue-Green Deployment
Run two identical environments and switch traffic after the new one passes checks.
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 [v1.0] โ 100% live traffic
Green [v2.0] โ deploy + test here
Switch: Blue โ standby
Green โ 100% live traffic
Rollback: flip switch back instantlyTradeoffs
Pros
Fast rollback and clean release boundary
Cons
Requires duplicate capacity
Examples: AWS CodeDeploy, Kubernetes service switching