Progressive Delivery and Compatible Changes
Promoting one immutable artifact through environments settles which bytes run. It does not settle who sees the new behavior first, whether old and new versions can run side by side, how you will know the change is harmful, or what you will do when it is. Those questions decide whether a bad release affects a handful of requests for a few minutes or every user until someone intervenes, and they are the subject of progressive delivery.
This article covers four connected topics: canaries and feature flags as ways to control exposure, schema and API compatibility as the condition that lets versions coexist, telemetry as the evidence that drives decisions, and rollback decisions together with the ways rollback fails. By the end you should be able to design a rollout in which exposure grows in stages, a stated rule decides whether to continue, every state the system passes through is compatible with the versions that may be running, and the options for stopping or reversing are planned before the first user is exposed.
Prerequisites: the preceding article on deploying the same artifact across environments established that an artifact is identified by a digest, that configuration is versioned separately from it, that promotion gates and deployment validation check evidence and compatibility, and that a rollback needs both a retained artifact and a state it can still run against. This article takes those as given and asks what happens in production after a deployment starts. It assumes general programming knowledge, basic SQL, and comfort reading small Python programs.
Three short scripts, written for this article, appear where they make a calculation or an ordering concrete; the outputs shown are what local runs of those scripts printed. Numbers in the worked examples are assumptions stated as such, and the rollout plan near the end is an illustrative scenario, not a report of a real system.
Deployment is not release
A deployment makes a version available in an environment. A release exposes behavior to users. Treating them as one event means the first exposure is also the full exposure. Separating them gives you places to stop. Four mechanisms do the separating, and they differ in what they control and what they can tell you.
| Mechanism | What it controls | What it can reveal | What it cannot reveal |
|---|---|---|---|
| Rolling update | How quickly instances are replaced by the new version | Startup failures, readiness problems, crashes under load as instances turn over | Behavior that appears only for particular users, data, or after time passes |
| Canary deployment | The fraction of live traffic or instances that runs the candidate | Differences in error rate, latency, and other signals between canary and control on real traffic | Rare cases that the canary traffic never includes; problems that need long processing time |
| Blue-green deployment | Which of two prepared environments receives traffic | Whether the prepared environment works before cutover, if it is tested first; a fast switch back | Anything involving state both environments share, notably the database |
| Feature flag | Which code path runs for which requests, independent of the deployed version | The effect of the new path on a chosen cohort | Problems in the flag-off code, initialization, or shared code that ship with the deployment |
These combine. A common arrangement deploys a new version with its new behavior switched off, sends a small share of traffic to it as a canary to check the deployment itself, then enables the behavior gradually with a flag. Each layer answers a different question: does the new version run, does it behave on live traffic, does the new behavior help or harm. Shadow testing, which sends copies of live inputs to a candidate whose answers are not used, is a separate technique for cases where exposing users is not acceptable. It cannot show how users would react and it must not duplicate real side effects.
Kubernetes’ Deployment controller provides rolling updates, with maxSurge and maxUnavailable both defaulting to 25 percent according to the documentation. A rolling update controls replacement speed. It does not by itself compare the new version’s behavior with the old, and it does not stop on a bad error rate unless you add that logic. The documentation notes that progressDeadlineSeconds reports a stalled rollout as failed but does not roll back automatically. Progressive delivery tools such as Argo Rollouts add staged steps and analysis on top, which the canary section describes.
Canaries
Google’s SRE Workbook defines canarying as a partial and time-limited deployment of a change in a service and its evaluation. A canary is the small deployment, and the control is the remainder of the service running the current version. The evaluation compares the two to decide whether to proceed. The design problem is making that comparison informative.
Population, duration, and what a comparison needs
The SRE Workbook says a canary population must be large enough and last long enough to be representative, that it should receive enough traffic to detect defects reliably, and that it should span relevant periods such as peak traffic. It advises comparing the canary against a control running at the same time, since before-and-after comparisons are noisy because conditions change over time. It also cautions against running several canaries on the same service at once, because the signals contaminate each other. And it lists what canaries can miss: defects that need long processing time to appear, rare cases without enough traffic, state-dependent interactions through caches or cookies, and problems masked by failures in infrastructure that the canary and control share.
A traffic percentage is an exposure setting, not a statistical design. The size of the canary determines how large a difference you can reliably detect, and the following script makes that concrete under stated assumptions. The assumed baseline error rate is 0.5 percent, an illustrative figure and not a benchmark. The first table uses the normal approximation to the one-sided two-proportion test, with significance level 0.05 and power 0.80, to estimate requests needed in the canary group to detect a rise to several candidate rates. The second table gives an approximate 95 percent upper bound on the true failure rate when a canary sees no failures, using the reasoning that if the true rate is \( p \), the chance of zero failures in \( n \) requests is \( (1-p)^n \approx e^{-pn} \), and setting that equal to 0.05 gives \( p \approx 3/n \), since \( \ln 20 \approx 3 \). The last part simulates a fixed abort rule: abort if 20 or more failures occur among the 2,000 requests the canary is assumed to receive. The script uses only the standard library. The sample-size and upper-bound tables are deterministic. The simulated abort rates use a fixed seed, so a different random generator would give slightly different percentages.
import math, random
def z_power_n(p0, p1, alpha_z=1.645, power_z=0.842):
"""Per-group sample size for a one-sided two-proportion z-test (normal approximation)."""
pbar = (p0+p1)/2
num = (alpha_z*math.sqrt(2*pbar*(1-pbar)) + power_z*math.sqrt(p0*(1-p0)+p1*(1-p1)))**2
return num/((p1-p0)**2)
print("Assumed baseline error rate 0.50%. Requests needed per group to detect a rise (one-sided, alpha 0.05, power 0.80):")
for p1 in (0.0075, 0.010, 0.020, 0.050):
print(f" candidate true rate {p1*100:4.2f}% -> about {math.ceil(z_power_n(0.005,p1)):>8,d} requests in the canary")
print("\nIf the canary sees zero failures in n requests, an approximate 95% upper bound on its failure rate is 3/n:")
for n in (50, 500, 5000, 50000):
print(f" n={n:>6,d}: upper bound about {3/n*100:6.2f}%")
# Monte Carlo: how often does a fixed rule (abort if canary failures exceed a threshold) fire?
random.seed(7)
def trial(p, n, threshold):
fails = sum(random.random() < p for _ in range(n))
return fails >= threshold
n = 2000 # requests the canary receives during the observation window (assumed)
threshold = 20 # abort if 20 or more failures (1.0% of 2,000)
for label, p in (("healthy candidate (0.50% true rate)", 0.005), ("bad candidate (2.00% true rate)", 0.02), ("mildly worse (0.80% true rate)", 0.008)):
t = 5000
rate = sum(trial(p, n, threshold) for _ in range(t))/t
print(f"{label}: abort fired in {rate*100:5.1f}% of {t} simulated canaries")
Assumed baseline error rate 0.50%. Requests needed per group to detect a rise (one-sided, alpha 0.05, power 0.80):
candidate true rate 0.75% -> about 12,292 requests in the canary
candidate true rate 1.00% -> about 3,683 requests in the canary
candidate true rate 2.00% -> about 678 requests in the canary
candidate true rate 5.00% -> about 163 requests in the canary
If the canary sees zero failures in n requests, an approximate 95% upper bound on its failure rate is 3/n:
n= 50: upper bound about 6.00%
n= 500: upper bound about 0.60%
n= 5,000: upper bound about 0.06%
n=50,000: upper bound about 0.01%
healthy candidate (0.50% true rate): abort fired in 0.3% of 5000 simulated canaries
bad candidate (2.00% true rate): abort fired in 100.0% of 5000 simulated canaries
mildly worse (0.80% true rate): abort fired in 18.4% of 5000 simulated canaries
Read the results as follows. Detecting a rise from 0.5 percent to 0.75 percent needs on the order of twelve thousand canary requests under these assumptions, while a rise to 2 percent needs a few hundred. A canary that sees no failures in 50 requests has not shown the failure rate is low, because the upper bound is about 6 percent. The abort rule behaves as designed for a clearly bad candidate (it fired in every simulated run at a 2 percent true rate) and rarely fires for a healthy one (0.3 percent of runs at the baseline rate). A candidate that is mildly worse, at 0.8 percent, trips the rule in roughly one run in five, so such a regression is likely to slip through a canary of this size. That is a fact about this window and threshold, not about canaries in general: a longer window, a larger share, or a different rule changes the result. The simulation uses a fixed seed and the stated assumptions; it is a calculation about a model and not a measurement of any real service.
The exposure arithmetic also gives you a way to reason about cost. The SRE Workbook models the impact as the traffic exposed multiplied by the failure rate. A canary of 5 percent of traffic that fails every request affects 5 percent of requests for as long as it takes to detect and stop it. Detection time matters as much as the percentage, so measure how quickly your pipeline can notice and act, not only how small the first stage is.
Choosing the metrics and the stop rule
The SRE Workbook recommends metrics that indicate problems in the service and map to user-visible impact, preferring the service level indicators that already measure compliance with the service objective, ranked and limited to a manageable number, and attributable to the change. A service level objective gives the metric a threshold that means something to users, so the stop rule can be absolute (for example, availability in the canary population must stay above the objective) and not merely relative to the control.
Write the rule before the rollout, with four parts: which metrics, which populations are compared, how long to observe before each decision, and what happens on failure. Argo Rollouts expresses this declaratively. A canary strategy is a list of steps such as setWeight, which sets the share of traffic for the new version, and pause, which holds for a duration or until promoted. Background analysis can run during the rollout, and according to its documentation, if the analysis is unsuccessful the rollout is aborted. It also documents a caveat that matters for design: without a traffic router, the weight is approximated by scaling replicas, so 10 percent of 10 replicas gives one pod and other percentages are rounded to the nearest whole number of replicas. A stated 5 percent may therefore not be the real exposure, and the real exposure is what your statistics depend on.
Some requests need consistent routing. A user who sees the canary on one request and the control on the next may get inconsistent behavior, and a session that spans several requests may need to stay on one version. Decide whether assignment is per request, per user, or per session, and record it, because it changes both user experience and how you interpret the comparison.
What a canary is not
A canary is a release-safety mechanism. It is not automatically a randomized experiment, and differences between canary and control may come from differences in users, timing, and workload rather than from the change. Use it to stop harm and gather evidence, and keep any statistical claim of cause for a properly designed experiment. Unlike shadow testing, a canary affects real users and can trigger real actions, so the stop rule and the recovery path must work under the conditions in which they will be used.
Feature flags
A feature flag selects whether a behavior is active, often at run time, so code can be deployed before the behavior is exposed. Martin Fowler’s feature toggles article, by Pete Hodgson, divides flags into four categories that need different management. Release toggles hide unfinished work and are short-lived, with static configuration. Experiment toggles assign users to cohorts for A/B testing and need consistent per-user decisions. Ops toggles let operators degrade non-critical functionality, and some become permanent kill switches. Permissioning toggles control access by user type and are long-lived and decided per request.
The article also names three parts of any toggle system: the toggle point, which is the conditional in the code; the toggle router, which makes the decision; and the toggle configuration, which supplies the settings. Keeping these separate avoids scattering conditionals through the code and makes the decision testable on its own.
How gradual exposure by flag can work
A percentage rollout needs two properties. The same user must get the same answer each time, otherwise behavior flickers. And raising the percentage must only add users, never remove those already enabled. A common technique hashes the flag name together with a stable key such as a user identifier, maps the hash to a number between 0 and 100, and enables the flag if that number is below the rollout percentage. OpenFeature’s specification describes the evaluation context that carries this information: an optional targeting key that uniquely identifies the subject of the evaluation, plus custom attributes, which providers use for per-user overrides and fractional rollouts.
The script below implements that technique and checks the properties directly on 100,000 made-up user identifiers. The script uses only the standard library, and because the assignment is a hash of fixed strings the counts are deterministic.
import hashlib
def bucket(flag, key):
"""Map (flag, user key) to a stable number in [0, 100)."""
h = hashlib.sha256(f"{flag}:{key}".encode()).digest()
return int.from_bytes(h[:8], "big") / 2**64 * 100
def enabled(flag, key, percent): return bucket(flag, key) < percent
users = [f"user-{i}" for i in range(100_000)]
for p in (1, 5, 20, 50):
n = sum(enabled("new-checkout", u, p) for u in users)
print(f"rollout {p:>2}% -> {n:6d} of {len(users)} users enabled ({n/len(users)*100:.2f}%)")
at5 = {u for u in users if enabled("new-checkout", u, 5)}
at20 = {u for u in users if enabled("new-checkout", u, 20)}
print("every user enabled at 5% still enabled at 20%:", at5 <= at20)
other = {u for u in users if enabled("new-search", u, 5)}
print(f"overlap of 5% cohorts for two flags: {len(at5 & other)} users (independent flags would overlap about {len(at5)*0.05:.0f})")
same_salt = {u for u in users if enabled("new-checkout", u, 5)}
print("same flag, same key, repeated call -> same answer:", enabled("new-checkout","user-42",5) == enabled("new-checkout","user-42",5))
rollout 1% -> 1008 of 100000 users enabled (1.01%)
rollout 5% -> 5085 of 100000 users enabled (5.08%)
rollout 20% -> 19993 of 100000 users enabled (19.99%)
rollout 50% -> 49946 of 100000 users enabled (49.95%)
every user enabled at 5% still enabled at 20%: True
overlap of 5% cohorts for two flags: 263 users (independent flags would overlap about 254)
same flag, same key, repeated call -> same answer: True
The enabled counts track the target percentages closely, with small deviations from chance. Every user enabled at 5 percent stays enabled at 20 percent, which is what lets you raise the rollout without churn. Including the flag name in the hashed input makes cohorts for different flags independent, so the 5 percent cohorts for two flags overlapped by about the number independence predicts, instead of selecting the same users every time. This matters because a team that always exposes the same 5 percent to every new feature concentrates risk on the same people.
The sketch assumes a stable key exists. For anonymous traffic there may be no stable identifier, and a per-request random choice then gives inconsistent behavior. And it says nothing about where the decision is made: client-side flags can be read and altered by the client, so a flag that gates access to data or an operation must be enforced on the server, as with any permission check.
Costs, testing, and lifetime
Every flag adds a decision maintainers must understand and a behavior tests must cover. Each independent boolean doubles the number of possible configurations, so a small set can be tested exhaustively and a large set cannot. The practical guidance from the toggle literature is to test the configurations you intend to run in production and the fallback configuration, and not every combination. The flag-off path still ships: imports, initialization, schema changes, and shared code run in production even when the new path is never selected, so the candidate needs validation with the flag off as well as on.
Release flags should be removed soon after use, since an unused flag is a branch nobody remembers the purpose of. Create the removal task when the flag is introduced, with an owner and an exit condition. Operational flags have the opposite requirement: they must change quickly during an incident, so confirm that the path that changes them (authorization, propagation, and any deployment it depends on) works within your response target. Answering “which flags are on right now?” should take seconds, because flag state is part of which version of the system is running.
Two public failures involving flags
Public documents describe flag handling that went wrong in two different ways. The first is a reused flag. In its order against Knight Capital, the SEC describes an August 2012 incident in which a new trading feature repurposed a flag that had formerly activated old code, which was still present and callable on the servers. The new code was deployed in stages over several days, but a technician did not copy it to one of eight servers, and nobody reviewed the deployment, because the firm had no written procedure requiring a second review. When orders carrying the repurposed flag reached that server, the old code ran and sent child orders continuously. According to the SEC order, Knight lost over 460 million dollars. These are the SEC’s findings. The reading for rollout design is this article’s interpretation: a flag’s meaning is part of a contract that includes every version that may be running, so reusing a flag while an old version can still interpret it is a compatibility break, and a staged deployment is only as safe as the check that every instance received the intended version.
The second is a feature without a flag. Google Cloud’s incident report for June 12, 2025 says that a change to a quota policy feature “did not have appropriate error handling nor was it feature flag protected.” Policy data with blank fields exercised a code path that hit a null pointer and put binaries into a crash loop, and, in the report’s words, the metadata was replicated globally within seconds. The report is the source for these facts. The design reading is again this article’s: when data can reach every region in seconds, a flag and a staged rollout bound exposure only if they apply to the data path as well as to the binary, and the safest default for a new code path is to ship it dark.
Schema and API compatibility
Progressive delivery guarantees that more than one version runs at the same time. A rolling update has old and new instances serving together. A canary has two versions by definition. A flag has two code paths active. During any of these, both versions read and write the same databases, queues, and interfaces. A change that only the new version understands is therefore a change that breaks the old version while it is still serving.
Compatibility is directional. Backward compatibility means a new reader can read data written by an older writer, and forward compatibility means an older reader can read data written by a newer writer. State which versions and which format you are comparing, and test more than the immediately preceding version, since a rollback or a slow client may involve older ones. Schema evolution and compatibility covers the directions and upgrade ordering for data formats. A breaking change is incompatible with a supported interface, including its behavior and meaning, which means a field can keep its type while its meaning changes and structural checks still pass.
Readers that tolerate additions
Adding an optional field is usually safe, but only because consumers ignore what they do not recognize. A strict reader that rejects unknown fields breaks anyway. The last lines of the demonstration program shown later exercise both readers on a payload that gained a field.
Protocol Buffers’ guidance records the discipline for a format built around compatibility: never reuse a field number, reserve the number of a removed field so nobody reuses it, almost never change a field’s type, avoid adding required fields, and give enums an unspecified zero value because old clients see unrecognized new enum values as unset. Each rule prevents an old reader or old stored data from misreading new content.
Expand, migrate, contract
Expand and contract, also called parallel change, splits an incompatible change into three phases. Expand adds the new form while the old keeps working. Migrate moves consumers to the new form, which can take a long time for external clients. Contract removes the old form once nobody depends on it. Martin Fowler’s description notes it is a key component of evolutionary database design and that, for APIs, it decouples a supplier’s release from its clients’ upgrades. Each intermediate state must itself be releasable.
The program below applies it to a database column rename using SQLite, with two “application versions” as functions. Version 1 knows only full_name. Version 2 prefers the new display_name, falls back to the old column for rows not yet filled, and writes both columns. The steps mirror a real release: add the nullable column, deploy version 2 alongside version 1, backfill with one conditional statement, confirm that rolling version 2 back to version 1 still works, then drop the old column and see what version 1 can no longer do. It uses an in-memory database; DROP COLUMN needs SQLite 3.35 or later, and the run shown used 3.53.4.
import sqlite3, json
db = sqlite3.connect(":memory:"); db.row_factory = sqlite3.Row
db.execute("CREATE TABLE customer (id INTEGER PRIMARY KEY, full_name TEXT NOT NULL)")
db.execute("INSERT INTO customer VALUES (1, 'Ada Example')")
# Application versions. v1 knows only full_name. v2 prefers display_name and still writes both (transition build).
def v1_write(name): db.execute("INSERT INTO customer (full_name) VALUES (?)", (name,))
def v1_read(i): return db.execute("SELECT full_name FROM customer WHERE id=?", (i,)).fetchone()["full_name"]
def v2_write(name): db.execute("INSERT INTO customer (full_name, display_name) VALUES (?, ?)", (name, name))
def v2_read(i):
r = db.execute("SELECT full_name, display_name FROM customer WHERE id=?", (i,)).fetchone()
return r["display_name"] if r["display_name"] is not None else r["full_name"] # tolerate rows not yet backfilled
def attempt(label, fn):
try: print(f" {label}: {fn()!r}")
except Exception as e: print(f" {label}: ERROR {type(e).__name__}: {e}")
print("1. expand: add the new column, nullable. v1 keeps working.")
db.execute("ALTER TABLE customer ADD COLUMN display_name TEXT")
attempt("v1 reads row 1", lambda: v1_read(1)); attempt("v1 writes", lambda: v1_write("Grace Example"))
print("2. v2 deploys (reads new, falls back to old; writes both). Mixed fleet is safe.")
attempt("v2 reads row 1 (not backfilled)", lambda: v2_read(1)); attempt("v2 writes", lambda: v2_write("Linus Example"))
attempt("v1 reads v2's row 3", lambda: v1_read(3))
print("3. backfill in one conditional statement (rows already filled by v2 are skipped)")
n = db.execute("UPDATE customer SET display_name = full_name WHERE display_name IS NULL").rowcount
print(" rows backfilled:", n)
print(" rows still NULL:", db.execute("SELECT count(*) FROM customer WHERE display_name IS NULL").fetchone()[0])
print("4. rollback of v2 -> v1 at this point still works (old column is intact)")
attempt("v1 reads row 3", lambda: v1_read(3))
print("5. contract: drop the old column. v1 can no longer be a rollback target.")
db.execute("ALTER TABLE customer DROP COLUMN full_name")
attempt("v1 reads row 1", lambda: v1_read(1)); attempt("v1 writes", lambda: v1_write("Late Rollback"))
attempt("v2 writes (still writes both columns)", lambda: v2_write("Still v2"))
print("\nStrict versus tolerant readers of a payload that gained a field")
payload = json.dumps({"order_id": 7, "total_cents": 1250, "coupon": "SPRING"})
def strict(p):
d = json.loads(p); allowed = {"order_id", "total_cents"}
extra = set(d) - allowed
if extra: raise ValueError(f"unknown fields {sorted(extra)}")
return d["total_cents"]
def tolerant(p): return json.loads(p)["total_cents"]
attempt("strict reader", lambda: strict(payload)); attempt("tolerant reader", lambda: tolerant(payload))
1. expand: add the new column, nullable. v1 keeps working.
v1 reads row 1: 'Ada Example'
v1 writes: None
2. v2 deploys (reads new, falls back to old; writes both). Mixed fleet is safe.
v2 reads row 1 (not backfilled): 'Ada Example'
v2 writes: None
v1 reads v2's row 3: 'Linus Example'
3. backfill in one conditional statement (rows already filled by v2 are skipped)
rows backfilled: 2
rows still NULL: 0
4. rollback of v2 -> v1 at this point still works (old column is intact)
v1 reads row 3: 'Linus Example'
5. contract: drop the old column. v1 can no longer be a rollback target.
v1 reads row 1: ERROR OperationalError: no such column: full_name
v1 writes: ERROR OperationalError: table customer has no column named full_name
v2 writes (still writes both columns): ERROR OperationalError: table customer has no column named full_name
Strict versus tolerant readers of a payload that gained a field
strict reader: ERROR ValueError: unknown fields ['coupon']
tolerant reader: 1250
In the output, steps 1 through 4 show the useful property of the intermediate states: version 1 and version 2 both read and write correctly, rows written by either are readable by the other, the backfill touched only rows still missing the new value, and a rollback to version 1 at that point works. Step 5 shows the cost of contracting too early: version 1 cannot read or write at all, and even version 2, because it still writes both columns, now fails on every write. The final two lines of the output are the strict and tolerant readers: the strict reader rejects the payload because of the added coupon field, and the tolerant reader still returns the total. The contraction failure is the one that causes outages: dropping a column and removing the code that writes it are separate deployments, and the order is code first, column second.
This model uses SQLite 3.53.4 in memory, a single connection, and no concurrency. It does not show the race between a backfill and concurrent writers or the locking behavior of a large production table, both of which need their own design. The conditional backfill is safe in this script because nothing else writes during it, which is not a property you get for free in production. The glossary entry on expand and contract works through those concurrency cases.
Versions that skew
Compatibility also applies to components upgraded on different schedules. Version skew is the version difference between components upgraded separately, and some systems document a supported skew policy that fixes both the allowed combinations and the order in which components may move. If your own services lack such a written policy they still have an implicit one, and an incident is a poor time to discover it. A version number can communicate compatibility intent when it follows semantic versioning against a declared public interface, but a number does not migrate anyone, and retiring an old version still needs a dated deprecation.
Telemetry
A rollout decision is only as good as the signal behind it. Telemetry is data emitted to observe behavior: logs describe individual events, metrics describe measured quantities over time, and traces represent operations as linked spans. For a staged rollout, three requirements stand out.
First, every signal must be attributable to a version and cohort. Without a label for the deployed version and the flag state, the canary and control populations blur together and the comparison the whole approach depends on is impossible. Connect signals by service identity, instance, deployment version, and trace identifiers, because a collector cannot reconstruct context that was never emitted.
Second, the signals must reflect user impact and arrive in time. A metric that reports in five-minute intervals cannot support a one-minute observation window, a point the SRE Workbook makes about matching metric intervals to canary duration. Some harm shows up with a delay (a background job failing hours later, a data corruption found by a downstream report), so decide which delayed signals can still trigger action after the rollout reaches full exposure.
Third, absence of data is not evidence of health. A canary that receives no traffic for the relevant cases, a metric that drops out because the instrumentation changed, and a sampling policy that discards the rare event you care about all produce quiet dashboards. State each signal’s population, timestamp, sampling or drop policy, and identity before interpreting a missing or repeated record, and treat missing telemetry as a reason to hold, not to proceed.
| Question | Signal type | Compared across | Typical weakness |
|---|---|---|---|
| Is the new version running and ready? | Readiness and restart counts; deployment records | Canary instances versus control | Healthy process, wrong answers |
| Are requests failing more? | Error ratio per version | Canary versus control, same window | Too few requests to detect small increases |
| Is it slower? | Latency distribution per version, not only the average | Canary versus control, same window | Average hides a worse tail |
| Is it correct? | Domain checks, such as reconciliation totals or invariant counters | New versus old path on the same inputs | Needs a defined notion of correct output |
| Is it costly? | Resource use and downstream call volume | Canary versus control | Shared infrastructure can mask differences |
| Is the user outcome worse? | Business outcome measures | Flag cohort versus rest, per the experiment design | Lag, noise, and confounding |
Alerting during a rollout should reference the cohort, not only the service total. A bad canary at 5 percent traffic may move the overall error ratio by a fraction too small to cross a service-wide alert threshold, so the rollout’s stop rule has to look at the canary population itself. The converse also holds: an alert that fires on the service total during a rollout should prompt a check of which version those errors came from before anyone concludes the change is or is not responsible.
Rollback decisions and failures
Having stopped the exposure, you choose how to recover, and the options differ in speed, risk, and what they undo.
| Option | What it does | Fast when | Fails when |
|---|---|---|---|
| Turn the flag off | Stops the new code path without changing the deployed version | The flag evaluates quickly, the off path is tested, and data written by the new path is still readable | The problem is in code that runs regardless of the flag; the flag system is part of the failure |
| Reduce or halt exposure | Pauses at the current stage or returns canary traffic to the control | A routing control exists and responds quickly | Sticky sessions or already-written data keep affecting users |
| Roll back the deployment | Returns to a retained earlier artifact and configuration | The artifact and configuration are retained and compatible with current data and interfaces | The schema or stored data moved forward; the earlier version cannot run |
| Roll forward with a fix | Ships a corrected version | The fix is small, understood, and can pass the usual path quickly | The cause is unknown; the pipeline is slow |
| Suspend the operation | Stops the affected function entirely | A degraded or paused mode exists | Dependents have no fallback |
Rollback returns a system to a previously retained version and is useful only if that version can operate with current data, interfaces, and access requirements. It does not undo actions already taken: a message sent or an order accepted stays that way, and it needs investigation and authorized corrective action. If a database change cannot be reversed safely, a forward fix or temporary suspension may be preferable. Recovery succeeds when the service meets its requirements again, not when a command reports success, so verify which version is handling requests after the switch. Repointing an alias is not enough if running processes keep their previously loaded code.
A rule before the incident
Decide in advance who may stop a rollout and on what evidence, and make the safe action cheap. Automated analysis that aborts on a failed check removes delay for the clear cases, and a human decision covers ambiguous ones. Define what “abort” restores and whether the rejected change is marked as rejected, so that an automated process does not retry it without a decision. Record the decision, the evidence, and the state afterward, so the next release starts from what was learned.
Incident pressure favors the most visible action. The Knight Capital order shows how a plausible recovery step can worsen a failure. After the problem appeared, the firm removed the new code from the seven servers where it had been installed correctly. According to the SEC, that action made things worse, because incoming orders on those servers then activated the old code that was still present, as had already happened on the eighth server. The finding supports a design lesson with limits: before any rollback, ask what the target state does with the inputs currently arriving, including flags and data that the newer version introduced. An untested reverse path is a change like any other.
Why rollbacks fail
Several failure patterns recur, and each corresponds to a precondition that can be checked ahead of time.
- The old version cannot read new data. The new version wrote values or columns the old one rejects. Expand and contract and tolerant readers keep this condition true.
- The old artifact or its configuration is gone. Retention expired, a tag was overwritten, or the configuration that ran with it was not recorded. Retain both and record the pair.
- The flag changed meaning. The old code interprets a flag differently from the new code. Never reuse a flag name for a different behavior while any version that knows the old meaning can run.
- The rollback path is slower than the failure. A pipeline that takes thirty minutes cannot serve as the emergency stop for a failure that is expensive each minute. Use the flag or the traffic switch as the fast stop, and the pipeline for the durable fix.
- State outside the deployment moved. Caches, queues with messages in the new format, and external systems keep the new shape after the deployment reverts.
- Partial rollout and mixed versions. A deployment that reached some instances but not others, as in the Knight Capital order, leaves a fleet that is neither old nor new. Verify the version on every instance, not on the deployment object.
- Detection came after the point of no return. The contract step already dropped the old form. Place irreversible steps after the rollback window, and make them separate, explicit releases.
Each rollout has a blast radius, and blast radius is set by what is shared. Staging exposure by cohort or region only bounds the harm if the cohorts do not share the failing component, such as one database, one control plane, or one globally replicated data set. The Google Cloud incident shows what happens when data replicates everywhere within seconds. Identify what the canary and the control share before concluding that a canary contained a failure.
An illustrative rollout plan
The plan below is hypothetical, written to show how the pieces fit, not a description of a real system. Assume a checkout service whose current error rate is about 0.5 percent over a typical day, which is the baseline used in the earlier calculation, and assume the new version changes how totals are computed and adds a column to the orders table. All the thresholds are assumptions for the example.
- Expand the schema with a nullable column and verify that the current version still reads and writes. This step is releasable on its own, and the old version remains a valid rollback target.
- Deploy the new version with its behavior behind a flag that is off. Run a canary at a small share to check the deployment itself: readiness, restarts, error ratio against the control. Observe through at least one peak period, as the guidance recommends. The aim is to catch problems in the flag-off code.
- Enable the flag for internal users, then for 1 percent, 5 percent, and 20 percent of a stable user key. At each stage, decide in advance the minimum number of requests and the metrics: error ratio, latency tail, and a domain check that totals match between old and new computation on the same input. The earlier calculation shows why small stages detect only large regressions, so the plan states which regressions it can and cannot catch and relies on the next stage’s larger sample for subtler ones.
- Abort criteria. Turn the flag off if the canary-cohort error ratio exceeds the objective’s threshold for a defined window, or if the domain check shows any mismatch, or if telemetry for the cohort goes missing. Flag-off must work without a deployment.
- Backfill and switch reads only after the flag reaches full exposure and the metrics are stable for the agreed period.
- Contract after the rollback window closes: remove the code that writes the old column in one release, and drop the column in a later one.
This plan encodes the earlier points in order. Exposure grows in stages with stated rules, every intermediate state is compatible with the versions that may be running, signals are attributable to the cohort, the fast stop does not depend on the pipeline, and the irreversible step is last and separate. It does not guarantee a release without incident. It makes the first minutes of an incident procedural and the damage bounded by design.
Limits of this treatment
The statistics are simplified: the sample-size figures use a normal approximation for one fixed comparison, the abort rule is a fixed threshold rather than a sequential test, and real traffic is bursty, clustered by user, and not independent between requests. The flag script demonstrates the hashing technique on synthetic identifiers and says nothing about a particular flag service. The SQLite demonstration shows ordering and compatibility on one connection, not concurrency, lock behavior, or replication. The description of Argo Rollouts, Kubernetes, and OpenFeature comes from their documentation and was not exercised here. The incident accounts rely on the SEC order and Google Cloud’s report as published, and interpretation is marked as such. Platform behavior and defaults change, so confirm them against current documentation before depending on them.
References
- Google SRE Workbook, Canarying Releases
- Argo Rollouts, Canary Deployment Strategy
- Kubernetes Documentation, Deployments
- Pete Hodgson, Feature Toggles (aka Feature Flags), martinfowler.com
- OpenFeature Specification, Evaluation Context
- U.S. Securities and Exchange Commission, Order in the Matter of Knight Capital Americas LLC (Release No. 34-70694)
- Google Cloud, Incident report for June 12, 2025
- Martin Fowler, Parallel Change
- Protocol Buffers, Proto Best Practices: Dos and Don’ts
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
