
Cloud
Learning Level
Deploying new code requires strategy to avoid downtime and minimize risk.
Bad deployment (no strategy):
1. Stop all servers
2. Deploy new code
3. Start all servers
Result: 5-10 minutes downtime (customers angry)Good deployment (with strategy):
1. Deploy to 1 server while others run
2. Test new code
3. Gradually move traffic to new servers
Result: Zero downtime, instant rollback if problemDeploy to one server at a time, gradually replacing all.
Before deployment:
[V1] [V1] [V1] [V1] (4 servers, version 1)
Step 1:
[V2] [V1] [V1] [V1] (1 new, 3 old)
Step 2:
[V2] [V2] [V1] [V1] (2 new, 2 old)
Step 3:
[V2] [V2] [V2] [V1] (3 new, 1 old)
Step 4:
[V2] [V2] [V2] [V2] (all new)Pros:
Cons:
Two identical environments. Switch traffic from old to new instantly.
BLUE (Active) GREEN (New)
[V1] [V1] [V1] [V2] [V2] [V2]
ā ā
āā Traffic routes āāāāāāā Switch to GREEN
After switch successful:
GREEN (Active) BLUE (Standby)
[V2] [V2] [V2] [V1] [V1] [V1]
ā
āā All trafficPros:
Cons:
Deploy to small percentage of users first, expand if no problems.
Deployment:
āā 1% of traffic ā NEW version
āā 99% of traffic ā OLD version
Monitor for 10 minutes:
āā Error rate normal?
āā Response times okay?
āā Customer issues?
If all good:
āā 10% of traffic ā NEW
āā 50% of traffic ā NEW
āā 100% of traffic ā NEW
If problem:
āā Keep at 1%
āā Investigate issue
āā Rollback if neededPros:
Cons:
| Strategy | Downtime | Speed | Resource Cost | Risk | Rollback |
|---|---|---|---|---|---|
| Rolling | None | Slow | Low | Low | Manual |
| Blue-Green | None | Fast | High (2x) | Low | Instant |
| Canary | None | Medium | Medium | Very Low | Instant |
Deploy to 1% of servers first, monitor for hours, gradually expand to 100%.
Maintain duplicate infrastructure, switch instantly.
Cost-effective, works well for gradual deploys.
Modern deployment with automation:
Developer commits code
ā
Automated tests run
ā
Tests pass
ā
Deploy to canary (1% traffic)
ā
Monitor for errors
ā
No errors ā Gradually expand to 100%
ā
Deployed! (fully automated)Always plan for rollback:
New version deployed ā Error rate high
ā
Detect problem (1-2 minutes)
ā
Rollback initiated
ā
Traffic routes back to previous version
ā
Problem resolved (5-10 minutes impact)Want advanced patterns? š Deployment Strategies (Experienced)
Resources
Ojasa Mirai
Master AI-powered development skills through structured learning, real projects, and verified credentials. Whether you're upskilling your team or launching your career, we deliver the skills companies actually need.
Learn Deep ⢠Build Real ⢠Verify Skills ⢠Launch Forward