Bird
Raised Fist0
Microservicessystem_design~20 mins

Rollback strategies in Microservices - Practice Problems & Coding Challenges

Choose your learning style10 modes available

Start learning this pattern below

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
Challenge - 5 Problems
🎖️
Rollback Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
🧠 Conceptual
intermediate
2:00remaining
Understanding Blue-Green Deployment Rollback

In a blue-green deployment, if the new version (green) fails after release, what is the immediate rollback action?

ASwitch traffic back to the blue environment while fixing the green environment.
BRestart the green environment services to clear errors.
CDeploy a hotfix directly to the green environment without switching traffic.
DDelete the blue environment to force all traffic to green.
Attempts:
2 left
💡 Hint

Think about how blue-green deployment separates live and new versions.

Architecture
intermediate
2:00remaining
Rollback Strategy in Canary Releases

During a canary release, a small percentage of users get the new version. If errors are detected, what is the best rollback approach?

AIncrease traffic to the canary version to gather more error data.
BRestart the canary version services and continue routing traffic.
CDeploy a patch to the canary version without affecting traffic routing.
DStop sending traffic to the canary version and route all users to the stable version.
Attempts:
2 left
💡 Hint

Consider how canary releases limit exposure to new versions.

scaling
advanced
2:00remaining
Capacity Planning for Rollback in Microservices

You have a microservices system using blue-green deployment. To support rollback, what capacity planning approach is best?

AUse a single environment and redeploy on rollback to save resources.
BScale down the inactive environment to zero to save costs during normal operation.
CMaintain full capacity for both blue and green environments simultaneously.
DOnly keep the active environment running and recreate the other on rollback.
Attempts:
2 left
💡 Hint

Think about how quickly rollback must happen without downtime.

tradeoff
advanced
2:00remaining
Tradeoffs Between Database Rollback Strategies

Which rollback strategy for databases in microservices has the highest risk of data inconsistency?

AImplementing backward-compatible schema changes with feature toggles.
BUsing database backups to restore to a previous state.
CApplying compensating transactions to undo changes.
DRolling forward with patches to fix issues without rollback.
Attempts:
2 left
💡 Hint

Consider what happens to data created after the backup point.

estimation
expert
3:00remaining
Estimating Downtime During Rollback

A microservices system uses blue-green deployment with 10 services. Each service takes 30 seconds to switch traffic and 10 seconds to verify health. Estimate the minimum downtime during rollback if services are switched sequentially.

A400 seconds
B40000 seconds
C4000 seconds
D400000 seconds
Attempts:
2 left
💡 Hint

Calculate total time per service and multiply by number of services.

Practice

(1/5)
1. What is the main purpose of a rollback strategy in microservices?
easy
A. To quickly undo a bad deployment and restore the previous stable state
B. To add new features to the system without downtime
C. To permanently delete old versions of services
D. To monitor system performance continuously

Solution

  1. Step 1: Understand rollback purpose

    Rollback strategies are designed to revert changes that cause issues, restoring stability.
  2. Step 2: Identify correct purpose in options

    Only To quickly undo a bad deployment and restore the previous stable state describes undoing a bad deployment to restore a stable state.
  3. Final Answer:

    To quickly undo a bad deployment and restore the previous stable state -> Option A
  4. Quick Check:

    Rollback purpose = Undo bad deployment [OK]
Hint: Rollback means undo bad changes fast [OK]
Common Mistakes:
  • Confusing rollback with feature deployment
  • Thinking rollback deletes old versions permanently
  • Mixing rollback with monitoring
2. Which of the following is a correct description of the blue-green deployment rollback method?
easy
A. Switch traffic back to the old environment if the new one fails
B. Gradually increase traffic to the new version while monitoring
C. Manually fix database schema errors after deployment
D. Deploy new code directly to production without testing

Solution

  1. Step 1: Recall blue-green deployment basics

    Blue-green uses two identical environments; one active, one idle for new version.
  2. Step 2: Identify rollback action

    If new version fails, traffic switches back to old environment instantly.
  3. Final Answer:

    Switch traffic back to the old environment if the new one fails -> Option A
  4. Quick Check:

    Blue-green rollback = Switch traffic back [OK]
Hint: Blue-green rollback switches traffic instantly [OK]
Common Mistakes:
  • Confusing blue-green with canary deployment
  • Thinking rollback fixes database manually
  • Ignoring traffic switching concept
3. Consider this simplified code snippet for a canary deployment rollback trigger:
if error_rate > 0.05:
    rollback_canary()

What happens when the error rate exceeds 5% during canary deployment?
medium
A. The system continues deployment without changes
B. The error rate is ignored and logged only
C. The rollback_canary function is called to revert changes
D. The deployment is paused but not rolled back

Solution

  1. Step 1: Analyze the condition in code

    The code checks if error_rate is greater than 0.05 (5%).
  2. Step 2: Understand the action on condition true

    If true, rollback_canary() is called to revert the canary deployment.
  3. Final Answer:

    The rollback_canary function is called to revert changes -> Option C
  4. Quick Check:

    Error rate > 5% triggers rollback [OK]
Hint: Error rate > threshold triggers rollback function [OK]
Common Mistakes:
  • Ignoring the rollback call in the code
  • Assuming deployment pauses without rollback
  • Confusing logging with rollback action
4. A microservice deployment uses database migration with rollback scripts. The rollback script fails due to a syntax error. What is the best immediate action?
medium
A. Ignore the failure and continue deployment
B. Restart the service without rollback
C. Delete the database and start fresh
D. Manually fix the rollback script and retry rollback

Solution

  1. Step 1: Identify rollback script failure impact

    A syntax error in rollback script prevents safe undo of migration changes.
  2. Step 2: Choose safe recovery action

    Fixing the script manually and retrying rollback ensures data integrity and system stability.
  3. Final Answer:

    Manually fix the rollback script and retry rollback -> Option D
  4. Quick Check:

    Fix rollback script error before retrying [OK]
Hint: Fix rollback script errors before retrying rollback [OK]
Common Mistakes:
  • Ignoring rollback failure and proceeding
  • Deleting database without backup
  • Restarting service without fixing rollback
5. You have a microservices system using canary deployments with automated rollback on failure. Suddenly, a rollback triggers repeatedly due to a false positive error spike caused by monitoring noise. What is the best architectural improvement to reduce unnecessary rollbacks?
hard
A. Disable rollback automation and rely on manual checks
B. Implement a cooldown period before allowing another rollback
C. Remove monitoring to avoid false alarms
D. Rollback immediately on any error spike without delay

Solution

  1. Step 1: Understand problem cause

    False positive error spikes cause repeated rollbacks due to noisy monitoring data.
  2. Step 2: Identify architectural fix

    Adding a cooldown period prevents rapid repeated rollbacks, allowing noise to settle before next rollback.
  3. Final Answer:

    Implement a cooldown period before allowing another rollback -> Option B
  4. Quick Check:

    Cooldown period reduces rollback noise impact [OK]
Hint: Cooldown period prevents rollback storms from noise [OK]
Common Mistakes:
  • Disabling automation loses rollback benefits
  • Removing monitoring hides real issues
  • Rolling back immediately causes instability