CSE Roadmap

Core tier · about 3 hours · 7 parts

Part 6 of 7 · 2 min read

Feature flags

Code ships switched off; turning it on is a separate act.

Feature flags

The books give little on this, so the following is common practice, not from the books, apart from BM's idea of separating deployment from release. A feature flag (or toggle) is a switch in the code or in a settings service that turns a feature on or off without a new deploy. The code ships "dark" (off). Later the flag is turned on for staff, then for 1 percent of users, then for everyone. If it hurts the SLO, switching it off is a rollback in seconds, with no new artifact.

A made-up example. A new pricing rule goes live behind new_pricing. The flag is on for 1 percent of users for a day. The error budget burn rate stays below 1. It goes to 10, 50 and 100 percent over three days. On day 2 a rare bug is found, the flag is switched off, and no deploy is needed.

Cautions (common practice): flags are code paths, so old flags must be removed once the feature is settled, or the tangle grows. A flag change is a production change and should be logged and reviewed like one, given UDS's warning about unreviewed configuration.

Feature flag

A feature flag is a runtime switch that turns a feature on or off, or on for a share of users, without deploying new code.

Example: new_checkout = on for 5 percent of users.

Interview angle

Answer in your head first, then open it.

How do you release safely?

Automate a pipeline of review, build, pre-production and production. Roll out in small steps, check health signals and wait between steps, and roll back on a bad signal.

Canary or blue-green?

Canary sends a growing share of real traffic and needs richer routing. Blue-green switches all traffic at once and needs double capacity for a while.

How do you make a schema change safely?

Prepare, activate, cleanup: three backward-compatible steps.

Why prefer rollback to roll-forward?

Rolling forward needs a new, untested change under pressure. Rollback returns to a known state.

Check yourself: 1. How does a flag differ from a canary? 2. Why remove old flags? 3. Why should a flag change be reviewed?

Words you will meet

Word Meaning
CD pipeline An automated path from merged code to production
Artifact The deployable package that holds a change
Pull request A proposed change put forward for review
Smoke test A quick check that a deployment worked
Canary release Sending a small, growing share of real traffic to a new version
Blue-green deployment Two copies running, with traffic switched from one to the other
Bake time Waiting between steps to let problems appear
Rollback Returning to the previous version
Roll forward Releasing a new fix instead of going back
Feature flag A runtime switch for a feature