Quick revision
The short answer
Feature flags make changes safer because new code can be deployed switched off and then turned on gradually, for internal users, a small percentage or one region, and switched off again in seconds if errors rise. The common kinds are release flags, operational kill switches, experiment flags and permission flags. Their risks are that a flag flip is itself a production change, that every flag adds code paths and debt, and that the flag service becomes a dependency that must fail safely.
What to remember
In this answer, we saw that feature flags separate deploying code from releasing behaviour. Code goes out dark, is enabled for internal users, a percentage or a region, and can be turned off in seconds. We went through release, operational, experiment and permission flags, and the three risks that come with them: a flag flip is a real production change that needs gradual rollout, audit logs and monitoring; every flag adds code paths, so release flags need owners and expiry dates; and the flag service must be cached and backed by safe defaults so its outage is not everyone's outage.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
Feature flags make changes safer because new code can be deployed switched off and then turned on gradually, for internal users, a small percentage or one region, and switched off again in seconds if errors rise. The common kinds are release flags, operational kill switches, experiment flags and permission flags. Their risks are that a flag flip is itself a production change, that every flag adds code paths and debt, and that the flag service becomes a dependency that must fail safely.
Why this question is asked
When a team ships many times a day across many servers, the slowest and riskiest part of a bad change is undoing it. A rollback deployment can take ten or twenty minutes; a flag can be turned off in a few seconds. That is why almost every large engineering organisation uses flags, and why interviewers ask about them: they want to see that we know both the power and the costs. In this answer, we will recap what a flag is, follow a feature from a dark deployment to full release, go through the four kinds of flags, and then look at the three risks flags bring and how to manage each one.
1A Quick Recap: Deploying Is Not Releasing
Deploying means putting a new version of the code onto servers. Releasing means letting users see the new behaviour. Without flags the two happen at the same moment: the code goes out, and everyone gets it.
A feature flag is an if statement whose condition is read at runtime from configuration, usually from a flag service that the application polls or streams from. The new code path ships inside the deployment, but it only runs when the flag says so. The flag can also be evaluated per request, against a context such as the user id, the tenant, the country or the region, so the same server can show the new behaviour to one user and the old behaviour to the next.
Notice the second argument, false. That is the default value the client returns when the flag is missing or the flag service cannot be reached. We will come back to it, because choosing it well is part of using flags safely. The example uses OpenFeature, a vendor-neutral flag API; the idea is the same with any flag service.
2How a Flag Makes a Release Gradual and Reversible
With a flag, a release becomes a series of small steps instead of one jump. First we deploy dark: the code is present everywhere but the flag is off, so nothing changes for users. Then we turn it on for internal staff, who find the obvious problems. Then 1 percent of users, then 10, 50 and 100 percent, or one region at a time, watching error rates and latency between steps.
The reason this is safer is speed and size. If errors rise at 10 percent, only a tenth of users were affected, and turning the flag off takes seconds because no build, image pull or pod restart is involved. A rollback deployment for the same problem might take 15 minutes while every user is affected. Percentage rollouts usually hash the user id, so the same user stays in the same group from request to request and does not see the feature flicker on and off.
- Deploy with the flag offcode is present, behaviour unchanged
- Enable for internal usersstaff find the obvious bugs
- Enable for 1 percent, then 10 percentusers chosen by a hash of their id
- Errors or latency up?YesTurn the flag off in secondsNoWiden to 50 and 100 percent
- Remove the flag and the old paththe release flag has done its job
5 steps in order. Play them, or step through them one at a time.
3The Four Kinds of Flags
Not all flags are the same, and mixing them up causes trouble. A release flag exists only to roll out one feature; it should live days or weeks and then be deleted. An operational flag, often called a kill switch, is long-lived: it lets operators turn off an expensive feature, such as recommendations or a live counter, when the system is under heavy load. An experiment flag splits users into groups for an A/B test and must assign users consistently so the results are valid. A permission flag turns on features that some customers have paid for, which makes it part of the product, often for years.
| Kind | Lifetime | Typical use |
|---|---|---|
| Release flag | Days to weeks | Roll out a new feature gradually, then delete |
| Operational flag (kill switch) | Long-lived | Turn off an expensive feature under load |
| Experiment flag | Length of the test | A/B test with stable user groups |
| Permission flag | Months to years | Features sold to some customers or plans |
Knowing the kind tells us how to treat the flag. A release flag left behind for two years is debt. A kill switch that nobody has tested in a year may not work when we need it, so operational flags deserve a regular drill.
4Risk 1: A Flag Change Is a Production Change
It is easy to think of flags as safe by nature, but flipping a flag from 0 to 100 percent in every region at once is exactly as dangerous as deploying untested code everywhere at once. Several well-known outages were caused by a global configuration or flag change rather than by a code deployment.
So flags need the same discipline as deployments. Changes should be gradual, by percentage or by region. Every change should be recorded in an audit log with who changed what and when, so that during an incident we can line up a flag change with the moment errors began. And the dashboards and alerts we watch during a deployment should also be watched during a flag rollout.
5Risk 2: Flag Debt and Untested Combinations
Each boolean flag doubles the number of paths through the code. Ten independent flags give 1,024 possible combinations, and nobody tests all of them. Old flags also make the code harder to read, because a developer must work out which branch is really live.
The cure is ownership and expiry. Every release flag gets an owner and a removal date when it is created, and a ticket to delete it once it reaches 100 percent. For the combinations that matter, such as a new checkout together with a new payment provider, we write tests that run with the flags explicitly set both ways rather than trusting the defaults.
6Risk 3: The Flag Service Becomes a Critical Dependency
If every request asks a remote flag service for a value, an outage of that service becomes an outage of everything. Good flag clients avoid this by keeping the rules in memory, refreshing them in the background, and evaluating flags locally. When the service is unreachable, the client keeps using the last known values.
When there is no last known value, for example on a fresh pod that starts during the outage, the client returns the default from the code. That default must be the safe choice: usually the old, proven behaviour for a release flag, and for a kill switch the setting that keeps the core of the product working. Some teams also bake a snapshot of the flag values into the deployment, so a new pod starts with sensible values even when the flag service is down.
7Follow-up questions
What should the default be when a service cannot read a flag?
The default should be the value that is safe if we know nothing, which usually means the behaviour that existed before the flag. For a release flag that is off, so users get the old proven path. For a kill switch, it is the setting that keeps the core service running. Before falling back to the code default, the client should use the last value it successfully read, because that reflects what operators most recently decided. We should also alert when clients are running on stale or default values, so the problem is visible.
How do percentage rollouts keep a user in the same group?
The flag client hashes a stable key, usually the user id together with the flag name, into a number from 0 to 99, and the user is in the rollout if that number is below the percentage. Because the hash does not change, the user stays in the same group on every request, and raising the percentage from 10 to 20 only adds users without removing anyone.
8Conclusion
In this answer, we saw that feature flags separate deploying code from releasing behaviour. Code goes out dark, is enabled for internal users, a percentage or a region, and can be turned off in seconds. We went through release, operational, experiment and permission flags, and the three risks that come with them: a flag flip is a real production change that needs gradual rollout, audit logs and monitoring; every flag adds code paths, so release flags need owners and expiry dates; and the flag service must be cached and backed by safe defaults so its outage is not everyone's outage.
Open with
Feature flags let us separate deploying from releasing. We ship the code dark, with the flag off, then turn it on for internal users, then a small percentage chosen by a hash of the user id, or one region, and widen it while we watch errors and latency.
Then, if they want more
If something goes wrong we turn the flag off in seconds, which is much faster and smaller than a rollback deployment. I think of four kinds: short-lived release flags for rollouts, long-lived operational flags or kill switches to turn off expensive features under load, experiment flags for A/B tests, and permission flags for features some customers pay for.
The risks are real, though. A flag flip is a production change, so flipping one to 100 percent everywhere can cause an outage just like a bad deploy; flag changes should be gradual, audited and monitored. Every flag doubles the code paths, so each release flag gets an owner and an expiry date, and important combinations get tests.
And the flag service becomes a critical dependency, so clients should evaluate locally, cache the last known values and fall back to safe defaults, usually the old behaviour, when the service is unreachable.
About this answer
- Last updated
- 13 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "How do feature flags make changes safer at scale, which kinds of flags exist, and what...": https://scrivio-interview-library.netlify.app/architecture/high-availability/b8aab76426/