Sub topic 11
Rolling out in stages with a rollback path
This chapter assumes you can launch EC2 instances, use an Auto Scaling group (ASG) or a load balancer, and read CloudWatch metrics. It also assumes you have already right-sized the workload, checked Arm64 compatibility, built a multi-architecture image, and benchmarked price-performance. Here you will move real traffic in small steps and keep a fast way back.
Why stage the change
A benchmark shows how a workload behaves under a test load. It cannot show every production pattern, such as odd request types, cold caches, or a native library that fails only on one code path. A staged rollout limits the damage. If something is wrong, only a small share of users see it, and you can undo the change before the rest are affected.
Changing instance size and changing architecture are two separate changes. Do them one at a time. If you do both at once and latency rises, you will not know which change caused it.
A staged plan
- Pre-checks. Confirm the multi-architecture image tag or an arm64 AMI exists. Confirm your dashboards and alarms cover latency, error rate, CPU and memory.
- Canary. Add one or two Graviton instances beside the existing x86 fleet. Send a small share of traffic, around 5 to 10 percent.
- Widen. If the canary is healthy for a full traffic cycle (at least a day, and a peak period), raise the share to 25, then 50 percent.
- Complete. Move the remaining traffic. Keep the x86 capacity available for a defined period before you remove it.
Splitting traffic
With an Application Load Balancer, put the x86 and Graviton instances in separate target groups. Then use a forward action with weights on the listener. This command sends 10 percent of requests to the Graviton target group:
aws elbv2 modify-listener \
--listener-arn arn:aws:elasticloadbalancing:us-east-1:111122223333:listener/app/my-alb/0123456789abcdef/0123456789abcdef \
--default-actions '[{
"Type": "forward",
"ForwardConfig": {
"TargetGroups": [
{"TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:111122223333:targetgroup/app-x86/0123456789abcdef", "Weight": 90},
{"TargetGroupArn": "arn:aws:elasticloadbalancing:us-east-1:111122223333:targetgroup/app-arm64/0123456789abcdef", "Weight": 10}
]
}
}]'Run the same command with different weights for each later stage. Rollback is the same command with the Graviton weight set to 0.
Other options exist. For an ASG, a mixed instances policy can include both x86 and Arm64 types, but only if the launch template's AMI matches the architecture. A single AMI cannot serve both. For that reason, separate ASGs for each architecture are simpler to reason about. For ECS or Kubernetes, use separate capacity pools and shift tasks or pods between them.
Deciding to continue or stop
Write your gates before you start. Compare the Graviton group with the x86 group over the same period:
| Signal | Typical gate |
|---|---|
| p95 and p99 latency | Within an agreed margin of x86 |
| Error rate (5xx, failed jobs) | No increase |
| CPU utilization at the same load | Equal or lower |
| Memory and restarts | No new out-of-memory kills or crashes |
| Cost per request | Lower than x86, as benchmarked |
Use CloudWatch alarms on these signals so a person does not have to watch a dashboard. An alarm that fires during the canary is your trigger to roll back.
Keeping the rollback path real
A rollback plan helps only if it works at 3 a.m. Prepare these items before the canary:
- Keep the x86 target group and its instances running and healthy until the final stage is stable. Do not scale them to zero early.
- Keep the previous launch template version and AMI. Do not delete them.
- Keep the x86 image variant in the multi-architecture tag. The same tag then runs on either architecture.
- Write down the exact rollback command and test it during the canary, when the cost of a mistake is small.
- Check database schema or data format changes. If the new release also changes data, rolling back the instance type may not be enough.
Common errors
- Launching an arm64 instance type with an x86-64 AMI. The instance fails to boot into your application. Use an arm64 AMI.
- Pulling an image that has no
arm64variant. The container exits with anexec format error. - Judging the canary over too short a window and missing a peak.
- Removing the x86 fleet on the same day as the final cutover.
Exercise
You send 10 percent of traffic to a Graviton target group, and p99 latency rises while average CPU stays lower than on x86. What do you do, and why?
Show answer
Set the Graviton target group weight to 0 on the listener to send all traffic back to x86. Then investigate, for example a native library or a configuration difference. Average CPU does not show tail latency, so a lower CPU figure is not a reason to continue. Resume the rollout only after the cause is fixed and the gates pass.
Exercise
Why should you change instance size and architecture in separate steps?
Show answer
If you change both together and a metric worsens, you cannot tell which change caused it. Separate steps keep each cause identifiable and each rollback simple.