A blue-green deployment is a way of releasing a new version of a web application without taking the current version offline. You keep two identical production environments running side by side. One — conventionally called blue — is live and serving your users. The other — green — is idle. When you are ready to release, you deploy the new version into the idle environment, test it, and then switch the traffic over. If something goes wrong, you route traffic back to the original environment.
The core idea is straightforward, but the value depends entirely on context. For a small internal tool used by a dozen staff, the cost of running two full production environments rarely makes sense. For a SaaS platform where downtime directly affects revenue and customer trust, the trade-off looks very different.
What actually happens during the switch
The traffic switch is typically handled at the load balancer or DNS level. Users do not change anything on their end. From their perspective, the application simply continues to work. Behind the scenes, requests that would have gone to the blue environment are now routed to green.
After the switch, the blue environment stays available. If a problem appears that was not caught in testing — perhaps a third-party integration behaves differently under real load — you can switch traffic back to blue within minutes. The green environment can then be fixed and redeployed without users ever seeing a broken system.
What blue-green is not
Blue-green deployment is a release strategy, not a testing strategy. It does not replace proper quality assurance, user acceptance testing or staging-environment checks. It reduces the blast radius of a problem that slips through those earlier stages, but it assumes you have already done the work to catch what you can before the switch.
It is also not the same as a rolling deployment, where you update servers one at a time within a single environment. Rolling deployments use less infrastructure but create a period where different users may be hitting different versions simultaneously. Blue-green avoids that by keeping the versions strictly separated until the moment of the switch.
When blue-green deployment adds genuine value
- Revenue-critical SaaS products where even a short maintenance window translates directly into lost subscriptions or support tickets.
- Customer-facing portals used by external clients who expect continuous availability and may lose confidence after seeing error pages.
- Regulated environments where you need to demonstrate controlled, reversible release processes.
- Applications with unpredictable failure modes — for instance, systems that depend on live data from third-party APIs where staging testing can never fully replicate production conditions.
Infrastructure and cost implications
Running two production environments means roughly double the compute, database and associated hosting costs for the duration that both are active. Some businesses reduce this by keeping the idle environment at a smaller scale and scaling it up before a release, but that adds operational complexity and a short period of risk if the scale-up fails.
The exact cost impact depends on your hosting setup, the size of your application and whether your cloud provider charges for idle resources. This is a question to put directly to your development supplier or infrastructure team, with a clear request for a written comparison of single-environment versus blue-green running costs.
Session state and data considerations
If your application stores user session data locally on the application server — for example, in-memory session state — switching traffic to a different environment will log users out or break in-progress workflows. Before committing to blue-green deployment, confirm with your technical team whether session state is handled in a shared store such as a database or Redis, or whether it is tied to individual servers.
Background jobs, queued tasks and scheduled processes also need attention. If a batch process runs on a timer in the blue environment, switching traffic to green does not automatically move that process. You need a clear plan for which environment runs background work at each stage of the release.
Questions to put to a supplier
- How will session state be handled during the switch?
- What happens to background jobs and scheduled tasks during and after the traffic change?
- How quickly can traffic be reverted if a problem is detected?
- Is the switch automated, or does it require manual intervention?
- What monitoring is in place to detect problems immediately after the switch?
- What is the additional infrastructure cost, expressed as a monthly figure?
Treating the green environment as untested
The most frequent failure mode is deploying to green, performing a cursory check, and switching traffic without thorough testing. The green environment should go through the same level of testing you would apply before any production release. The difference is not that you skip testing — it is that you have a fast, reliable rollback path if testing missed something.
Forgetting about shared data
If both environments point to the same production database — which is common to avoid duplicating large data stores — a new version that changes the database schema can break the blue environment even before you switch traffic. This is a particular risk when database changes are involved, and it is why the interaction between blue-green deployment and database migrations needs careful planning by your technical team.
Assuming zero-downtime means zero-risk
Blue-green deployment eliminates downtime during the switch, but it does not eliminate the risk of deploying a buggy release. If the new version has a logic error that corrupts data, switching back to blue does not undo that damage. The rollback protects availability, not data integrity. For data-sensitive operations, additional safeguards such as feature flags or canary releases may be more appropriate.
Ignoring the rollback itself as a risk
Switching traffic back to blue after a failed release is not always seamless. If users created data in the green environment during the brief period it was live, that data may not exist in blue. Reverting traffic means those users lose their recent work or see inconsistent states. Your team needs a documented plan for handling data created in the green environment after the switch, including whether it is migrated, discarded or reconciled manually.
Key checks before committing to blue-green
- Session handling: Confirm that user sessions survive the traffic switch without forcing logouts.
- Background processes: Document which environment owns scheduled tasks and queues at each stage.
- Data sharing: Clarify whether both environments share a database, and if so, how schema changes are managed.
- Rollback data plan: Define what happens to data created in the new environment if you need to revert.
- Cost documentation: Get a written figure for the ongoing infrastructure cost of maintaining two environments.
- Automation level: Understand whether the traffic switch is scripted or manual, and who has the access and training to execute it.
- Monitoring coverage: Verify that error rates, response times and business-critical flows are being watched from the moment traffic switches.
Blue-green deployment is a powerful tool for specific situations, but it introduces real cost and complexity. The decision to use it should follow from a clear assessment of what downtime costs your business, what your current release process looks like, and whether simpler alternatives such as maintenance windows or rolling deployments already meet your needs.