Skip to content
~/petro

if the rollout is gradual, why did everything go down?

(7 months ago) · 14 min read · — views
Table of contents
  1. Recreate — how long can you be offline?
  2. Rolling — how much capacity remains between batches?
  3. Blue/Green — is the new environment ready for the load?
  4. which part of the problem does routing back solve?
  5. Canary — what do you need to observe before expanding?
  6. 5% of how much?
  7. Shadow — what can the copy do besides respond?
  8. how far can a failure reach?
  9. the migration ends after the code ships
  10. what I’d check before the next deploy

Friday, 3:12 PM. We changed an instance’s user_data.sh during a routine deploy. The strategy was Rolling: replace machines a few at a time while keeping the service available.

With the new dependencies, the instance took nine minutes to boot. During startup, the Auto Scaling Group marked instances as unhealthy and replaced them. The replacements repeated the cycle. We went from two instances to twenty, with none healthy, high latency, and 5xx errors.

The plan called for a gradual replacement. The configuration allowed us to run out of serving capacity.

A distinction that matters: In an ASG, instance warmup and the health check grace period serve different purposes. Warmup participates in scaling and gradual replacement decisions; the grace period allows initialization time before health checks trigger a replacement. A five-minute warmup alone doesn’t explain the termination cycle. AWS documents warmup and the grace period separately.

That incident is why I want to open the configuration when someone says, “we use Rolling deployments.” I want to know how long the application takes to respond, what the health check actually checks, and how much capacity remains while a batch is offline.

The strategy defines how a change spreads. Parameters, dependencies, and shared state determine whether the conditions it needs are in place. Choosing the strategy and checking those conditions belong in the same discussion.

Think of renovating a restaurant during business hours. You can close the dining room, renovate one section at a time, or prepare another kitchen. Each choice changes three things:

  • Continuity: who can still be served during the transition?
  • Cost: how much extra infrastructure needs to keep running?
  • Exposure to failure: how many people get food from the new kitchen before you evaluate the result?

The chart below compares these priorities. These are qualitative assessments: each strategy’s position helps frame the choice, but doesn’t measure the safety of your environment.

quick comparison

what each strategy prioritizes

closer to a corner = better at that goal

KEEP SERVICERUNNINGLOWERCOSTFEWER USERSAFFECTED

Rolling

Replaces a few instances at a time.

strong point
keeps the service running without cloning the whole fleet
in exchange
v1 and v2 must work correctly at the same time

I’ve put together a simulation for each strategy. Try the initial settings first, then change one parameter and watch what happens to requests, capacity, and cost.

Model limits: Timings are compressed; failures, latency, and divergence use illustrative probabilities. “LB delay” is a fixed delay before registering an instance, a simplification of readiness. The simulations help explore relationships between parameters. They don’t reproduce every provider behavior or serve as production benchmarks.


Recreate — how long can you be offline?

The old version, v1, shuts down completely before v2 starts serving. This is the restaurant closing for renovations: the interruption is part of the choice.

The flow has four steps: stop accepting new requests on v1, drain in-flight requests, shut down the old instances, and boot v2. Traffic resumes when the new version is ready.

I’d consider Recreate when the operation can accept a maintenance window and keeping two versions running costs more, or adds more difficulty, than that window. The decision needs to include how long recovery takes if v2 fails to start.

Shutting down the application doesn’t clear the database or make a migration compatible on its own. That work still needs to happen.

What it makes easier What you take on
No application version coexistence required Service unavailable during the transition
No need for two complete fleets running in parallel Recovery depends on starting a working version
Simple update sequence Database and external consumers still need compatibility
deploy config
1
2s
3s
4s
3 req/s
✓ compatible timingsThe LB delay covers the model's boot-time variance and drain covers maximum latency. Capacity, strategy, and other settings can still produce failures.
infrastructuredirect
v1
v1
ONLINE — service stable
request flowdirect
✓ 0
Usersv1load 0/13 in-flight requests0/13
success: 0error: 0

Try it: Run with one instance, then four. Compare draining and cost. Because the new instances boot in parallel, four machines don’t mean four times the downtime. Watch how long it takes for the first v2 to serve traffic and how much capacity is available afterward.


Rolling — how much capacity remains between batches?

Rolling replaces the fleet in batches. While one batch changes, the rest keeps serving. Creating replacements before retiring old instances uses temporary extra capacity: surge.

I’d start with one calculation: can the remaining instances handle the load at that time of day? Keeping one machine active satisfies a configuration minimum, but may not be enough to serve the requests.

There’s another condition: v1 and v2 coexist during the rollout. Both need to work with the same database and compatible contracts. Removing a column that v1 still reads breaks that condition, even with a batch size of one.

What it makes easier What you take on
Updates in stages, with old capacity available Must size the capacity remaining between batches
Can use the existing fleet Smaller batches may extend deployment time
Surge preserves capacity during replacement Requires extra resources and compatible versions
deploy config
4
2s
3s
4s
9 req/s
✓ compatible timingsThe LB delay covers the model's boot-time variance and drain covers maximum latency. Capacity, strategy, and other settings can still produce failures.
strategy parameters
1
2
12
infrastructure
v1
v1
v1
v1
v1
ONLINE — service stable
request flow
✓ 0
UsersLBv1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13
success: 0error: 0

Try it: Set “Min active” to zero and “Batch size” to its maximum. The batch now drains all old capacity. In a separate run, increase “Boot time” and reduce “LB delay”: in this model, traffic can arrive before the application is ready, causing failures and replacement attempts. Changing one thing at a time helps isolate the cause.

I’d start with Rolling for an application whose versions can coexist, with enough capacity and checks that reflect real serving readiness. If the transition requires validating a whole environment before it receives traffic, I’d consider Blue/Green.


Blue/Green — is the new environment ready for the load?

Blue keeps serving while you prepare Green, a parallel environment with the new version. After checking Green, you change the traffic destination.

That separation gives you room to check configuration, dependencies, and flows before the cutover. One question remains: what happens when the load arrives all at once?

Cold caches and connections that haven’t been established yet can put pressure on the database. A health endpoint returning 200 doesn’t show that the environment can handle that moment. Cutover also depends on routing: switching load balancer destinations and changing a DNS record have different timing and behavior.

What it makes easier What you take on
Checks the new environment while the old one serves Maintains parallel capacity during the transition
Can send traffic back to Blue while it’s available Must ensure Blue still accepts the current state
Separates preparation from cutover Cold caches and shared dependencies still matter

With two equivalent fleets, application capacity approaches twice the original size during the overlap. That doesn’t double the entire monthly bill: duration, databases, networking, and other services all contribute.

deploy config
2
2s
3s
4s
8 req/s
✓ compatible timingsThe LB delay covers the model's boot-time variance and drain covers maximum latency. Capacity, strategy, and other settings can still produce failures.
strategy parameters
2
infrastructure
blue
v1
v1
green
ONLINE — service stable
request flow
✓ 0
UsersLBv1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13
success: 0error: 0

Try it: Set “Cache Pre-warming” to zero in the strategy parameters. The model simulates resource contention after cutover and may produce 504 timeouts. Compare it with a warmed-up run. Being ready to answer a check and being ready for the load are different things to verify.

which part of the problem does routing back solve?

If Green fails, pointing traffic back to Blue can restore service quickly. That switch doesn’t automatically undo what the new version has already done.

Suppose v2 published an event, sent an email, or wrote data in a format v1 doesn’t understand. Each effect needs its own response: compensate for an operation, correct records, restore data where appropriate, or ship a fix.

I’d keep traffic rollback in the plan and check what it can recover. If the previous version is no longer compatible with the data, switching routes can introduce another failure. “We can roll back” needs to specify the version, the data it will encounter, and how long recovery takes.


Canary — what do you need to observe before expanding?

Canary sends a portion of traffic to v2 and uses the results to decide whether to expand exposure. Before starting, you define the initial group, the signal that allows promotion, and what stops the rollout.

I’d consider Canary when I can observe a regression in a representative portion of usage and act before expanding it. If the relevant flow never reaches the selected group, a longer observation window may still leave the question unanswered.

What it makes easier What you take on
Starts with limited exposure to the new version Shared dependencies can extend the impact
Uses production signals to guide promotion Requires separate metrics for v1 and v2
Lets you stop expansion Needs volume, duration, and criteria suited to the failure you’re looking for
deploy config
4
2s
3s
4s
9 req/s
✓ compatible timingsThe LB delay covers the model's boot-time variance and drain covers maximum latency. Capacity, strategy, and other settings can still produce failures.
strategy parameters
4
infrastructure
v1
v1
v1
v1
v1
ONLINE — service stable
request flow
✓ 0
UsersLBv1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13
success: 0error: 0

In this simulation, promotion follows timed stages and instance availability. It shows traffic distribution, but doesn’t perform the statistical analysis that would guide a production promotion.

Canary and A/B testing: A Canary evaluates a change before expanding it. An A/B test compares product outcomes between variants. Both can route by group, with different decision criteria.

5% of how much?

“15 minutes at 5%” tells you the duration and the proportion. You still need to know how many requests pass through and which failure you’re trying to detect.

Assume an independent failure with a 0.1% probability per request. The chance of observing at least one occurrence in n requests is 1 - (1 - 0.001)^n. Reaching 95% takes approximately 3,000 Canary requests. At 5% of traffic, that’s roughly 60,000 total requests.

This calculation only estimates the chance of observing one occurrence under those assumptions. It doesn’t mean 95% confidence that the version is safe, or replace a comparison against v1’s error rate. Failures concentrated in particular customers or flows also require a sample that includes them.

The SRE Workbook chapter on Canary releases discusses volume, representativeness, and metric selection. I’d set the window to observe the behavior that prompted the test. If traffic doesn’t allow that, I’d record the limitation and seek additional evidence before promoting.


Shadow — what can the copy do besides respond?

With Shadow, v1 keeps responding to the user. A copy of the request reaches v2, whose response is discarded from the client’s perspective. You can compare content, errors, and latency without using the new response to serve users.

For example, this can help check whether a new search implementation returns the expected results for production queries. The work is deciding what to compare and how to handle acceptable differences, such as timestamps or equivalent result ordering.

Discarding the response doesn’t prevent side effects. If the copy executes a payment, sends an email, or writes to the production database, it can repeat the original operation. Shared resources can also suffer from the extra load. I’d only use Shadow after defining those effects, isolating the destinations that need it, and limiting mirroring.

What it makes easier What you take on
Compares the new version using production inputs Must isolate side effects and resources
Keeps v1’s response for the user Mirroring adds processing
Can mirror only a sample Must interpret divergence and failures in the copy itself
deploy config
3
2s
3s
4s
9 req/s
✓ compatible timingsThe LB delay covers the model's boot-time variance and drain covers maximum latency. Capacity, strategy, and other settings can still produce failures.
infrastructure
prod
v1
v1
v1
mirror
ONLINE — service stable
request flow
✓ 0
UsersLBv1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13v1load 0/13 in-flight requests0/13
success: 0error: 0

Try it: Watch the extra fleet and the response comparison. This simulation mirrors all traffic. A divergence doesn’t change the response delivered by v1, but tells you something about v2. A failed copy leaves a gap in the comparison.


how far can a failure reach?

The chart shows how the new version comes in: from stopping the old one first to testing both side by side.

Stop and replace

Service offline

Test side by side

The old version keeps serving

Recreate

Stop the old, start the new

Rolling

Replace a few at a time

Blue/Green

Prepare the new, then switch traffic

Canary

Start with a little traffic

Shadow

Copy traffic to test

To discuss blast radius, I’d add the environment’s boundaries. At which layer does the change happen? What shares a database, queue, cache, or capacity with the new version?

Where you control the change What you need to define
Process Which connections, files, and resources it shares
Pod or container How traffic reaches it and which services depend on it
Instance or VM How much capacity leaves and joins each batch
Region or global route Which users change destinations and which dependencies remain shared

A Canary receiving 2% of requests can saturate a database used by 100% of them. The routing percentage measures direct exposure to the new version; the possible impact also depends on those connections.

I’d describe a rollout by stating who gets the change, what remains shared, and which signal makes us stop. Those details let you assess risks that the strategy’s name leaves open.


the migration ends after the code ships

If v2 removes a column that v1 still queries, coexistence breaks. That includes old instances, workers, and jobs that only run overnight. The application deployment can finish before all those consumers change.

For this kind of change, Expand & Contract, also called Parallel Change, divides the work into expansion, migration, and contraction. For a column change, I’d organize it this way:

  1. Expand: add the new representation while keeping the old one usable. If writing both formats, define how to keep them consistent.
  2. Migrate: populate and verify historical data, update consumers, and move reads to the new format.
  3. Contract: remove the old format after checking that applications, jobs, and versions still intended for rollback no longer depend on it.

That interval can span several releases. Removing the column depends on ending the dependency; waiting a week alone doesn’t establish that.


what I’d check before the next deploy

Back to the opening incident: Rolling described the intention to preserve service during the transition. We needed to check whether startup, health checks, and capacity supported that intention in the configuration we used.

For the next deploy, I’d bring these questions:

  1. What demonstrates that an instance is ready? Measure boot time and check what the health check actually exercises.
  2. How much serving capacity remains? Check batch size, remaining capacity, surge, and in-flight requests.
  3. Which versions need to coexist? Include the database, events, and consumers that update at a different pace.
  4. What evidence allows promotion? Define the signal, volume, observation window, and stopping condition.
  5. What can recovery undo? Separate routing traffic back from handling effects already produced.

I’d change strategies when those answers reveal a constraint: an acceptable maintenance window, limited capacity for coexistence, a need to validate under real traffic, or data incompatible with the previous version. That’s where the choice gets a reason you can verify.

If you’d like to keep experimenting, choose a parameter you use in production. Predict the effect before changing it. Then compare your prediction with the result and the limits of this model.


results from this page’s simulations

what happened to the requests

Compare failures, completed requests, and cost across this session's runs.

no simulations run yet

Run a simulation above. Results from this session will appear here.