Step 1 · The pattern
Shipped, but switched off
Every server runs a build that contains a new code path. A flag service decides who takes it. Right now the answer is nobody: the code is deployed, and the behaviour is still off.
- request
- served, old path
In short
Feature flags & kill switches: how it works and how it breaks
Shipping code and switching behaviour on are two separate acts. If a new code path goes out with no flag, it is live on every server as soon as the build lands, and it stays that way. The input that breaks it may not be a deploy at all. It can be a piece of data written days later and copied to every server in seconds, so the whole fleet fails together. The only way back is to roll the binary out again, which is slow. Behind a feature flag, the same code ships switched off. It is enabled for a small share first, watched, then widened. If it misbehaves, only that share is hurt, and a kill switch turns the path off everywhere in moments, with no new build. The switch is code too: test it, and keep it reachable when things are on fire.
How this comes up in interviews
"A service starts crash-looping in every region at once, and nothing was deployed today. How do you stop it, and how should that code have been shipped?"
Then they ask
- The flag service itself is down. What do your servers do, and which default do they fall back to?
- The flag has been fully on for months. Why might flipping the kill switch make things worse?
- How do you ramp a flag by percentage so each user sees consistent behaviour, and how do you stop old flags piling up?
A strong answer covers
- Deploying code and switching behaviour on are separate acts: ship the path off, enable a small share, watch, then widen.
- With no deploy, the trigger is an input such as data copied to every server, so a restart reads the same data again.
- A kill switch turns the path off across the fleet in moments with no new build, where a binary rollback is slow.
- The switch is code too: test both states, keep it reachable during an incident, and choose a default for when the flag service is down.
- Flag changes that spread instantly deserve the same care as any other change.
Points to cover, not a script. Say them in your own words and tie them to a system you have worked on.
On one page: the track cheat sheet.
Sources: Google Cloud incident report, 12 June 2025 ↗ · Feature Toggles (aka Feature Flags), Pete Hodgson on martinfowler.com ↗ · Report a problem
Diagrams are our own simulations: the timings, rates and counts in them are illustrative, not measurements. Captions are original wording.