Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Recall & Review
beginner
What is blue-green deployment?
Blue-green deployment is a technique where two identical environments (blue and green) are used to deploy new software versions. One environment runs the current version, while the other runs the new version. Traffic switches from blue to green once the new version is ready.
Click to reveal answer
beginner
Why use blue-green deployment in microservices?
It reduces downtime and risk by allowing quick rollback. If the new version has issues, traffic can switch back to the old environment without affecting users.
Click to reveal answer
intermediate
What is a key requirement for blue-green deployment?
Having two identical production environments that can run independently and handle full user traffic.
Click to reveal answer
intermediate
How does traffic switching work in blue-green deployment?
Traffic is routed via a load balancer or DNS switch from the current environment (blue) to the new environment (green) once the new version passes tests.
Click to reveal answer
advanced
What are some challenges of blue-green deployment?
It requires double infrastructure cost, data synchronization between environments, and careful handling of database schema changes.
Click to reveal answer
What does the 'green' environment represent in blue-green deployment?
AThe current live version serving users
BThe new version of the application ready to receive traffic
CA testing environment not connected to production
DA backup environment for disaster recovery
✗ Incorrect
In blue-green deployment, the green environment hosts the new version before switching traffic.
What is the main benefit of blue-green deployment?
Since current_env == "blue", it sets current_env = new_env, which is "green".
Final Answer:
"green" -> Option D
Quick Check:
Switching from blue to green prints green [OK]
Hint: If current is blue, switch to green [OK]
Common Mistakes:
Confusing assignment direction
Expecting original value to print
Thinking code has syntax error
4. A team uses blue-green deployment but users report downtime during the switch. What is the most likely cause?
medium
A. The old environment was not shut down
B. Traffic was switched before the new environment was fully ready
C. The database was not updated
D. The new environment was tested too long
Solution
Step 1: Understand downtime cause in blue-green
Downtime usually happens if traffic switches before the new environment is ready to serve requests.
Step 2: Evaluate options
Old environment running or database update issues don't cause immediate downtime during switch; testing too long delays deployment but not downtime.
Final Answer:
Traffic was switched before the new environment was fully ready -> Option B
Quick Check:
Premature traffic switch = downtime [OK]
Hint: Switch traffic only after new env is ready [OK]
Common Mistakes:
Assuming old env causes downtime
Ignoring readiness checks
Blaming database updates for switch downtime
5. You manage a critical microservices system using blue-green deployment. After switching traffic to green, you discover a severe bug. What is the best immediate action to minimize downtime?
hard
A. Switch traffic back to blue environment immediately
B. Fix the bug in green environment and keep traffic there
C. Restart both environments simultaneously
D. Deploy a new environment and switch traffic there
Solution
Step 1: Understand rollback in blue-green deployment
Blue-green allows quick rollback by switching traffic back to the previous stable environment (blue).
Step 2: Evaluate options for minimizing downtime
Fixing bug in green delays recovery; restarting both causes downtime; deploying new environment takes time.
Final Answer:
Switch traffic back to blue environment immediately -> Option A
Quick Check:
Rollback by switching traffic = minimize downtime [OK]
Hint: Rollback by switching traffic to old env fast [OK]