What is a Feature Flag?
Feature flags, told as a story about building a new ride, drawing a curtain over it, and using a switch to decide who gets to see it.
A new ride opens to every guest, all at once.And if something goes wrong, the whole thing has to close again.
If rolling back means redeploying code, the rollback itself is slow.That's what happens when building and showing are bundled into one step.
Build the ride but keep the curtain drawn, and a switch decides who gets to see it.Flip it on or off without redeploying any code.
Turn the dial a little at a time — staff only, then 1% of guests, then everyone.Each step is checked before moving to the next.
Too many curtains (switches), and it gets hard to track what's even on.Once it's done, the curtain itself has to come down.
Feature flags = building a new ride and leaving the curtain drawn, using one switch to decide who sees it, instantly, without redeploying code.
A technique that separates deploying code (pushing it to servers) from releasing it (showing it to users). It lowers risk through a gradual rollout, lets you flip a kill switch the instant something breaks, and powers dark launches that show a feature to a narrow audience first.
When grown-ups say it
- Feature flag
- The curtain over a new ride, and its switch. Separates building something from showing it.
- Gradual rollout
- Widening from staff, to 1% of guests, to everyone. Each step gets checked before the next.
- Kill switch
- The switch you flip off the instant something breaks. No need to redeploy any code.
- Targeting
- Deciding who gets to see it first. Like staff only, or guests in one region only.
- Dark launch
- Quietly turning it on for a slice of guests first. To most guests, the curtain still looks drawn.
- Relation to canary
- A canary runs a new version on a few servers; a flag shows a different screen on the very same servers. Both are ways of trying something on a small slice first.
- Difference from blue-green
- Blue-green swaps the whole thing and back; a flag splits by person instead. They differ in the unit they roll back.
- A/B testing
- Showing two versions to different guests and comparing them. The same switch technology can run experiments, too.