Sub topic 14
Rehearse Rollback Procedures
Assume you understand model deployment, production monitoring, APIs, and basic version control. This chapter focuses on practicing a rollback before a real incident. A rehearsal is a controlled test of the decision, communication, traffic change, artifact selection, and validation steps.
Why rehearsals matter
A rollback plan can fail even when the model artifact is correct. Common failures include:
- The team cannot find the expected artifact.
- The rollback command uses the wrong environment.
- A dependency is missing from the older release.
- Database or feature schemas have changed.
- Traffic returns to the old model, but alerts still point to the new version.
- Operators do not know who can approve the change.
- The rollback succeeds technically but worsens business results.
A rehearsal exposes these gaps without waiting for customer impact. Run it in a staging environment first. For higher-risk systems, repeat it with limited production traffic or a controlled game day.
Design the rehearsal
Use a realistic scenario, such as an error-rate increase after a model release. Define the starting state, the expected response, and the conditions for stopping the exercise.
| Rehearsal item | Example |
|---|---|
| Starting release | `2026.03.15`, production |
| Known-good release | `2026.03.08`, validated |
| Trigger | Error rate above 4% for five minutes |
| Traffic plan | 10% to the old release, then 100% |
| Success condition | Error rate below 3%, p95 latency below 250 ms |
Keep the exercise reversible. Label test changes clearly, record timestamps, and make sure the team can restore the starting release. Do not use synthetic traffic that could trigger real customer actions.
from dataclasses import dataclass
@dataclass
class Rehearsal:
current_version: str
target_version: str
target_digest: str
traffic_percent: int = 0
passed: bool = True
def move_traffic(self, percent: int) -> None:
if not 0 <= percent <= 100:
raise ValueError("traffic must be between 0 and 100")
self.traffic_percent = percent
print(f"Moved {percent}% of traffic to {self.target_version}")
def validate(self, error_rate: float, p95_latency_ms: int) -> None:
self.passed = error_rate <= 0.03 and p95_latency_ms <= 250
print(f"Validation passed: {self.passed}")
rehearsal = Rehearsal(
current_version="2026.03.15",
target_version="2026.03.08",
target_digest="sha256:bbb",
)
print(f"Verify artifact {rehearsal.target_digest}")
rehearsal.move_traffic(10)
rehearsal.validate(error_rate=0.02, p95_latency_ms=210)
rehearsal.move_traffic(100)Walk through the runbook
A useful rehearsal follows the same sequence as a real rollback:
- Announce the simulated incident and assign an incident lead.
- Confirm the trigger using dashboards and logs.
- Freeze unrelated deployments.
- Identify the known-good version and verify its digest.
- Check code, dependency, schema, and feature compatibility.
- Apply the smallest safe traffic change.
- Observe model quality, service health, and downstream behavior.
- Decide whether to continue, stop, or restore the starting release.
- Record each command, approval, measurement, and timestamp.
- Close the exercise and review the gaps.
The rehearsal should test both technical and human actions. Ask an operator to follow the runbook without relying on undocumented memory. Ask a second person to act as approver and challenge unsafe steps.
Measure and improve the process
Track the time to detect, approve, execute, and validate the rollback. Record every manual step that caused confusion. Review whether alerts fired, dashboards separated model versions, and audit logs captured the change.
Repeat the rehearsal after fixing important gaps. Automation is safe only when it includes guardrails such as an allowlist of artifact digests, minimum observation periods, approval rules, and an automatic stop when validation fails.
Exercise
During a rehearsal, the old model starts successfully, but its feature schema is incompatible with the current service. What should the team do?
Show answer
Stop the traffic shift, restore the starting release if needed, and update the rollback plan to include schema compatibility checks or a compatible service version.