Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Blue-Green Deployment
HLD

Blue-Green Deployment

Two full environments, one instant switch — atomic cutover and its cost.

The Topology

 two complete, identical environments:

 [LB]──100%──►[BLUE: v1 serving]
              [GREEN: v2 idle, fully deployed]

 deploy: green gets v2 → smoke-tested privately
 switch: LB flips 100% to GREEN atomically (one config change)
 rollback: flip back. seconds.

 [LB]──100%──►[GREEN: v2 serving now]
              [BLUE: v1 kept warm for rollback window]

 the entire fleet changes version in ONE step — no mixed-
 version window ever exists.

What It Buys

 □ ATOMIC cutover: no partial-version states, ever.
   the cleanest answer where N/N+1 compatibility is impossible
 □ INSTANT rollback: previous environment still standing;
   flip = seconds (vs rolling's slow reverse-march)
 □ FULL-ENVIRONMENT testing before exposure:
   green under synthetic load, migrations rehearsed,
   integration verified — all pre-cutover ✓
 □ simple mental model: which color is live? done.

The Costs You Accept

 □ DOUBLE capacity during deployment windows:
   both environments running simultaneously.
   at serious scale this is real money / real provisioning time
 □ DATABASE is shared and NOT blue-green by default:
     schema must serve BOTH versions around cutover →
     expand-contract discipline still required!
     (the env flips; the data doesn't)
 □ LONG-RUNNING requests at cutover: in-flight work on blue
   when traffic flips → drain strategy needed (keep blue
   serving existing connections briefly)
 □ CACHE state: green's caches are COLD at cutover →
   warm them synthetically or eat a stampede against shared stores

 the database point deserves repetition: teams reach for
 blue-green to escape schema-compatibility work and discover
 the DB drags it back in. environments are easy to duplicate;
 state is not.
ConcernBlue-green answer
Instant rollbackflip back ✓ best-in-class
Zero mixed-version window✓ its superpower
Cost efficiency✗ double footprint
Progressive user exposureweak (all-or-nothing)

Interview Framing

“Deploy a payment service where any mixed-version moment is unacceptable” scored shape: topology + atomic-flip mechanics drawn, superpower named precisely (no mixed-version window), costs led by shared-database reality + cold-cache warning, drain handling for in-flight, comparison note vs canary (atomicity vs gradualism). Blue-green questions test whether you see past the diagram to the state that doesn’t flip colors.

My Private Notes

Notes are auto-saved locally to this device.