Safe Deployment and Rollback Strategies Questions
Releasing changes to production safely and incrementally, and recovering when they fail: blue-green, canary, and rolling deployments, feature flags, dark launches, traffic shifting, and progressive rollout, together with rollback strategies, safe-deploy practices, blast-radius containment, automated recovery, and safe forward/backward migration. Covers deployment orchestration across cloud platforms, staged exposure of new behavior to users, assessing deployment risk, designing reversible releases, and restoring a known-good state quickly. Focuses on how a release reaches production and how it is unwound on failure, distinct from broader incident command, which lives in Enterprise Operations & Incident Management.
How does chaos testing fit into your release-validation process: what faults would you inject during a canary phase, what safety controls limit user impact, and how do the results feed back into your rollout gates?
Sample Answer
Direct answer
Chaos testing fits into release validation as an OPTIONAL, carefully-scoped extra layer specifically for high-stakes releases: deliberately injecting a controlled failure (a dependency timeout, a node loss) during the canary phase to confirm the new version degrades gracefully under real adversity, not just under the ordinary traffic conditions a normal canary window happens to see.
Structured elaboration
- What faults to inject, and why during canary specifically: a simulated downstream-dependency timeout or error, a simulated node/pod loss, or injected network latency, run against the CANARY specifically (not the full production fleet) so any bad outcome from the chaos experiment itself is contained to the same small blast radius the canary was already limiting exposure to.
- Why canary is the right phase for this: a normal canary window validates behavior under whatever REAL conditions happen to occur during that window, which might not include a dependency hiccup at all; deliberately injecting one during canary tests a failure mode you might not otherwise observe before the release reaches full production traffic, catching a regression in error-handling or fallback logic specifically, not just in the happy path.
- Safety controls: a strict, pre-defined blast-radius limit on the experiment (only the canary's already-small traffic slice, never full production), an explicit kill switch to abort the chaos experiment immediately if it's causing more disruption than intended, and running it only during a window with adequate on-call attention, never as a fully unattended, unmonitored background process on a live release candidate.
- Feeding results back into rollout gates: if the canary handles the injected fault gracefully (a proper fallback, no cascading failure, error rates staying within an acceptable degraded-but-controlled band), that's positive evidence feeding into the normal promote/rollback decision alongside the standard metrics; if it reveals a genuine gap (the new version doesn't handle the injected failure as gracefully as the current stable version does), that's grounds to halt promotion and fix the gap, treated as seriously as a metric-based canary failure would be.
Worked example
A canary at 5% traffic has a chaos experiment injecting a simulated 2-second timeout on calls to a specific downstream dependency for a bounded 5-minute window. The canary's fallback logic (serving a cached, slightly stale response rather than erroring) engages correctly, and error rate stays within the acceptable band throughout, positive evidence added to the normal canary-analysis decision. On a different release, the same experiment reveals the canary's NEW error-handling path doesn't actually engage the fallback at all under this specific failure and instead returns a hard error to users, correctly halting that release's promotion despite the release having looked otherwise clean under normal traffic conditions.
Trade-offs and pitfalls
Chaos experiments add real operational overhead (someone needs to design, run, and monitor the experiment, not just watch a dashboard passively) and a genuine (if bounded) risk of their own, since deliberately injecting a failure is inherently a controlled but real risk; the right calibration is reserving this for releases where the failure mode being tested is actually plausible and consequential enough to justify the overhead, not running it as a blanket requirement on every routine release regardless of risk.
What makes a database migration backward-compatible? Give an example of a safe and an unsafe schema change, and explain why backward compatibility matters for rollback and phased deployment.
Sample Answer
Direct answer
A backward-compatible migration is one where the OLD version of your application code still works correctly against the NEW schema. That matters because during a rolling or canary deployment, old and new code run against the same database simultaneously, so if the new schema breaks the old code, you have an outage the moment the rollout starts, before you've even finished deploying.
Structured elaboration
- Safe (backward-compatible) changes: adding a new nullable column, adding a new table, adding a new index, widening a column's type (e.g. int to bigint in most databases). Old code that doesn't know about the new column simply ignores it; nothing it does breaks.
- Unsafe (non-backward-compatible) changes: renaming or dropping a column the old code still reads or writes, adding a NOT NULL column with no default (old code's INSERT statements, which don't set that column, start failing), changing a column's type in an incompatible direction (bigint to int, string to enum), or adding a foreign-key constraint on data the old code might still write in a way that violates it.
- Why it matters for rollback specifically: if you deploy a schema change together with new code and then need to roll the CODE back, the old code needs to keep working against the schema as it now stands, which is exactly the backward-compatibility property. If the migration wasn't backward-compatible, rolling back the code doesn't fully undo the outage, because the schema is still in its new, incompatible state.
Worked example
Safe: adding a nullable discount_code column to an orders table. Old code that doesn't reference it keeps working exactly as before. Unsafe: renaming orders.total to orders.total_amount in the same deploy as the code change that uses the new name; if you need to roll back the code while the rename has already run, the rolled-back old code tries to read orders.total, which no longer exists, and every read fails.
Trade-offs and pitfalls
Backward-compatible migrations usually take more steps and more calendar time (add, backfill, switch, THEN remove the old column in a later, separate deploy) than a direct rename, which is the trade-off teams are making: more process for a rollback safety net. The common mistake is treating "the migration ran successfully" as the same thing as "the migration is safe," when the real test is whether the PREVIOUS version of the application still functions correctly against the new schema.
You detect a deployment-induced regression affecting only one user cohort. How do you determine the cause without rolling back globally, and what does a targeted remediation look like?
Sample Answer
Direct answer
Investigating a cohort-specific regression without a global rollback starts by narrowing WHAT'S different about that cohort (a request attribute, a data characteristic, a routing path) and testing that specific hypothesis directly, then remediating narrowly, targeting only the affected cohort, rather than reflexively rolling back everyone because you haven't yet localized the cause.
Structured elaboration
- Characterize the cohort precisely: what defines it (a region, a device type, an account tier, a specific request header combination)? The more precisely you can define the boundary, the faster you can form a real hypothesis about the cause.
- Compare cohort-specific request/response data against the unaffected population: pull a sample of failing requests from the affected cohort and a sample of succeeding requests from elsewhere, diffing what's actually different in the request shape, headers, or data values, not just assuming the deploy is uniformly at fault.
- Test the hypothesis directly: if you suspect the cohort's requests hit a different code path (feature-flagged differently, routed to a specific backend), reproduce it in a controlled environment (staging, or a synthetic request matching the cohort's characteristics) rather than experimenting further in production.
- Targeted remediation options, roughly fastest to slowest: a feature flag scoped specifically to that cohort (if the risky code path can be identified and gated); routing that cohort's traffic specifically back to the old version while everyone else stays on the new one, if your infrastructure supports cohort-targeted routing; a narrow, fast-tracked code fix for the specific edge case, if the root cause is well-understood and the fix is small and low-risk.
- Why not a global rollback: if the new version is working correctly for everyone else, a global rollback discards real value (everyone else's improvement) to fix a problem that's isolated and, once understood, fixable narrowly; it's also slower in a real sense, since you still have to eventually re-ship the fix and re-canary the whole population again from scratch.
Worked example
A regression only affecting users with a specific, unusual account configuration (say, an account with more than a certain number of linked payment methods) traces, via diffing failing versus succeeding request payloads, to an off-by-one array-indexing bug that only triggers past that threshold. The targeted remediation is a feature flag specifically gating the new logic OFF for accounts above that threshold while the fix is developed, leaving the vast majority of users (below the threshold) unaffected and still benefiting from the new version.
Trade-offs and pitfalls
Targeted remediation requires your infrastructure to actually SUPPORT cohort-specific control (a flag with cohort targeting, or routing that can distinguish a specific user segment), which not every system has built in; without it, the only real lever might genuinely be a global rollback, which is itself a useful thing to recognize and invest in fixing for next time. The common mistake is spending too long trying to characterize a rare, hard-to-reproduce cohort-specific bug while it continues affecting real users, when a temporary, narrow mitigation (even an imperfect one, like disabling the specific feature for that cohort entirely) could have limited the damage while the real fix is developed.
Compare client-side and server-side feature-flag evaluation for a mobile app with intermittent connectivity. Which is safer for a rollout, and how do you define the default behavior when a flag can't be fetched?
Sample Answer
Direct answer
Server-side evaluation is generally safer for a rollout because the server can change a flag's value instantly and consistently for every client, while client-side evaluation depends on each device having up-to-date flag configuration, which is exactly what breaks down under intermittent connectivity.
Structured elaboration
- Client-side evaluation: the app itself decides whether a feature is on, usually based on a flag configuration it fetched and cached at some point. Faster to evaluate at request time (no network round-trip needed) and works fully offline, but a device on a stale cache keeps using an OLD flag value until it next successfully syncs, which for an intermittently-connected mobile app could be minutes to hours out of date.
- Server-side evaluation: the server decides on each request. Always reflects the current flag state instantly and consistently, but requires a live connection for every decision that depends on the flag, which is a problem for a mobile app trying to work offline or under a flaky connection.
- Default behavior when a flag can't be fetched: this is the crux of the safety question. The system needs an explicit, deliberately chosen default for "no data available," and that default should almost always be the SAFE, conservative behavior (feature OFF, or the old known-good code path), never "assume the last cached value is still correct" for anything risk-sensitive, since an unreachable device might be running a stale cache for an unknown, possibly long, period.
Worked example
A payment-related feature flag on a mobile app with client-side evaluation: the SDK is configured so that if it can't reach the flag service within a short timeout, it falls back to a hardcoded, safe default (feature OFF) rather than serving whatever was last cached, which might be hours or days stale if the device has been offline. This costs some feature-availability under poor connectivity (some users see the old behavior more often than strictly necessary) in exchange for never risking a stale, potentially-unsafe flag state driving payment logic.
Trade-offs and pitfalls
A hybrid is common in practice: client-side evaluation for speed and offline resilience, paired with a short cache TTL and a conservative, explicit fallback value baked into the SDK for when the cache is stale or fetch fails, rather than a pure binary choice between client-side and server-side. The common mistake is an SDK that silently serves an arbitrarily-old cached value with no TTL or fallback logic at all, which quietly turns "intermittent connectivity" into "unpredictable flag state," exactly the failure mode a well-designed flag system exists to prevent.
What does 'zero-downtime deployment' mean in practice? Describe a rolling-update pattern that achieves it for a service that isn't running in Kubernetes: how do you manage traffic shifting, session affinity, connection draining, and graceful shutdown during the update?
Sample Answer
Direct answer
Zero-downtime deployment means users never experience a failed request or a visible interruption because of the deploy itself; achieving it outside Kubernetes on, say, a fleet of VMs behind a load balancer means the same core ideas Kubernetes automates for you (gradual replacement, draining, health-gating) but implemented explicitly with your own tooling.
Structured elaboration
- Traffic shifting: deregister an instance from the load balancer BEFORE touching it, not after; most load balancers (an ALB, an nginx/HAProxy config, a cloud LB) support this via a deregistration API or a health-check-based removal, giving in-flight connections time to drain before the instance stops receiving new traffic.
- Session affinity: if the load balancer uses sticky sessions, deregistering an instance means those users' NEXT request goes elsewhere and picks up a new session, which is fine for stateless session handling (session state in a shared store like Redis) but breaks in-memory session state tied to that specific instance; the real fix is externalizing session state rather than working around instance-level stickiness during deploys.
- Connection draining: after deregistration, wait a configured drain period (matching your load balancer's own connection-draining timeout) before actually stopping the old process, so in-flight requests complete rather than being cut off mid-response.
- Graceful shutdown: the application itself needs to handle a shutdown signal by finishing current requests and refusing new ones, rather than exiting immediately, working WITH the load balancer's drain period rather than assuming the LB alone solves it.
- Pattern: replace instances in small batches (say, one at a time or a small percentage), health-checking each replacement before removing the next old instance, mirroring what Kubernetes' rolling update does automatically but implemented via your own deploy scripts or configuration-management tooling.
Worked example
A fleet of 20 VMs behind an ALB: the deploy script deregisters instance 1 from the target group, waits for the ALB's configured drain timeout (say 30 seconds) for in-flight requests to complete, then stops the old process, deploys the new version, starts it, waits for it to pass a health check, and re-registers it, before moving to instance 2. This one-at-a-time approach is slow for 20 instances but maximizes safety; a batched version (5 at a time) trades some of that safety margin for speed.
Trade-offs and pitfalls
Doing this manually (without Kubernetes automating it) means you own building and testing the orchestration logic yourself, including the failure-handling: what happens if a replacement instance fails its health check, does the script halt and alert, or does it blindly continue removing more old instances regardless? The common mistake is deregistering an instance and immediately killing the old process without respecting the load balancer's actual drain timeout, which silently drops in-flight requests despite the deployment otherwise looking clean.
Unlock Full Question Bank
Get access to all 48 Safe Deployment and Rollback Strategies interview questions and detailed answers.
Sign in to ContinueJoin thousands of developers preparing for their dream job.