by Raphael D. Pinheiro @raphaklaus
Some years ago software and hardware engineers faced a problem somehow like this:
How can I deploy a new software version in a way that I minimize the bug risk and downtime? - some sensible dev
👍 Ability to smartly route a percentage of the traffic to either green or blue environments, reducing even more the risk of a system fall-down
Feature flags are mechanisms that control the flow of a system according to any relevant criteria.
By its core definition, it enables faster and safer feature rollouts by controlling which group of users are going to see that new feature change.
Ultimately, that will empower us to do Continuous Delivery.
Feature flags give a software organization the power to reduce risk, iterate quicker, and gain more control. - featureflags.io
Think about it as a Canary release method on steroids.
- Because it let you release things in a safe and granular way
Release feat-xyz to 5% of the usersRelease feat-xyz to users of just X city
- Because in an event of failure, just turn off the flag to go back to the working state. No rebuilds, no redeploys.
- Because the stakeholders don't need to wait weeks to see one change live. Ship fast!
- Because A/B testing is also powerful.
- By using a feature flagging service like LaunchDarkly
- By creating your new features/changes behind a flag
- By having just one long-lived branch:
masterdevelopdoesn't make sense here
- By creating smart user segmentation so you can target your changes to a very specific group
- By stablishing a culture of writing tests
- By having good monitoring tools
- By listening to the support engineering team's feedback
- By ensuring we have an amazing CI
- Compile
- Solid types and contracts
- Static analysis
- Tests
#...
case flag("new-auth-system", user) do
true -> use_new_auth_system()
_ -> use_old_auth_system()
endRule of thumb: Whenever the code you are changing might affect the user experience. That simple.
- Ship often
- Faster feedback
- Safer deploys
- Learn how to operate the FF service (LaunchDarkly in our case)
- Enlarge the ownership level of the developer. One task is done when it works on production for 100% of the userbase rather than when it is merged
- No more "release days"
- QA role will have to be repurposed.
- Staging environment doesn't exist here
- We will perform all validations and tests in the best environment ever: production
- Give QA access over our metrics and other tools
- Write more and meaningful tests
- Open channel with support engineering team
- You start by saying:
Ok, show this feature just to 10% of the userbase - Communicate that on the relevant channels
- Check the logs and listen to support feedback
- If all good, start to ramp it up gradually 4.1 If an error is found, turn off the FF to go back to the working state 4.2 If all is good during a reasonable timespan, remove the FF from the code
- Deploy to a small group like QA team + few non-sensible users or opted-in beta users
- Expand this group to broader audience composed by the previous group + 10% of userbase
- Continue expanding until needed
- The main difference here is that we can include as many user groups as we want before hitting the real userbase.
Sooner or later, issues on production are inevitable. But we can make them speak more quietly or shut them up at any moment if we work properly using Feature Flags.


