Feature flags and progressive delivery
Separate deploying code from releasing features, roll out by percentage and segment, and keep flag debt under control.
14 min readDeploy is not release
A feature flag wraps new behaviour in a runtime check, so code can reach production switched off. Deploying becomes a routine, low-risk event, and releasing becomes a business decision made by changing a flag, with no new build. If the feature misbehaves, turning the flag off takes seconds, much faster than reverting and redeploying. Flags also let teams merge unfinished work to the main branch daily instead of maintaining long-lived branches, which avoids painful merges and keeps CI meaningful for everyone.
Kinds of flags
Flags differ in lifetime and risk, and should be managed differently. Treating every flag the same leads either to bureaucracy for a two-week release toggle or to carelessness with a kill switch that protects the database during peak. Label each flag with its type when it is created, because the type decides who may change it, whether a change needs review, how long it is expected to live and what happens when it is evaluated with no rules available. A kill switch must default to the safe state; a release flag must default to off.
- Release flags: short-lived, hide a feature until it is ready; remove within weeks of full rollout
- Experiment flags: assign users to variants for A/B tests with stable hashing
- Ops flags or kill switches: long-lived switches that disable expensive features under load
- Permission flags: enable features per plan or tenant, effectively product configuration
Progressive delivery
Progressive delivery rolls a feature out in steps: internal staff, then 1% of users, then 10%, 50% and 100%, watching SLIs at each step. Hash the user or tenant ID into a bucket so each user gets a consistent experience across requests. Tie the rollout to the error budget: an automated guard can pause or reverse a rollout when the error rate of the flagged cohort exceeds the control group. Annotate dashboards with every flag change, because a flag flip is a production change and must be visible during incident triage.
Evaluation at scale and flag debt
Flag checks sit on hot paths, often several per request, so evaluation must be local and fast. SDKs download rules, cache them in memory and receive updates by streaming, so a check takes microseconds and still works if the flag service is down, with safe defaults for unknown flags. The hidden cost is debt: stale flags multiply code paths and test combinations. Give every flag an owner and expiry date, and alert when release flags outlive it. Removing the flag from code is the last step of every rollout.
Key takeaways
- Flags turn releases into reversible configuration changes
- Roll out by consistent hashing in steps, guarded by SLIs
- Evaluate flags locally from cached rules with safe defaults
- Every flag needs an owner and an expiry to avoid flag debt
Sign in to track lessons and earn badges.