Your DevOps team wants to deliver business value as often and fast as possible. Ideally, you want to release a new feature whenever it seems ready. With feature flags you can achieve this selective releasing, but how do you do this in a structured and maintainable way that fits well with DevOps practices?
In this session, we will look at the implementation of feature flags in cloud-native applications, the platform needed to support it, and some strategies and patterns related to feature flagging, such as rings and A/B testing. You will learn how to build and maintain this using the Microsoft platform with .NET applications, Azure and Azure DevOps. Also, we will cover how to get feedback from the feature flags and loop it back to the deployment and release pipelines and environments to achieve an automated and stable system during release.
At the end of this session, you know how to get started with feature flags for continuous release DevOps style.
6. Reality of feature branches
Team uses long lived branches
Harder to merge
Feature can only be released
when complete
7. From feature branches to code branches
Main
Feature A
Feature B
if (feature.IsEnabled("NewSearchPage"))
{
// New feature implementation
}
8. Features in a different way
Back to “trunk based development”
Push functionality when and to whom you want
Be able to expand or “rollback“ without redeployment
10. Why should you want feature flags?
Code branch management
Other reasons include
11. Original approach for a new feature
New feature is
included and
replaces old
Requires a rollback
to revert to original
code
All or nothing releases
12. The new ‘if’ statement
If statement
evaluates state
of feature flag
First always off Incomplete
feature can be
still be deployed
aka Toggle Router and
Feature Toggle
There might not be an
original feature
14. The new ‘if’ statement
Flags are released three times
Flag logic needs
to be removed
15. Feature flag categories
Release Operations Experiment Permission
• Performance
related
• Manual circuit
breakers
Short
to long-lived
• On/Off
Kill-switch
• Testing
scenarios
• Dynamic
Short lived
• Percentage
• Time Window
• Deploy
incomplete
code
• Time release
Short-lived
• On
• Off
• Percentage
• Targeted users
• Defining
cohorts
User or
request based
• Claims
• Cookies
• Tenant
16. Feature management
Rules and settings for evaluation in feature toggle
Application
Logic
Rules
Evaluates and
filters on
certain
conditions
Settings
Determines
flag state
Multiple
parameters
17. Feature context
Named key-value pairs
Different per environment
Feature Value
LeaderboardListLimit On
APIv2 Parameters
BetaWebsite Opt-in
Feature Value
LeaderboardListLimit Off
APIv2 Off
BetaWebsite Opt-in
Feature Value
LeaderboardListLimit On
APIv2 Off
BetaWebsite Opt-in
18. Ingredients for feature management
In process service for evaluation
Externalized storage of key/value pairs
19. Tools and platforms for feature management
Microsoft .NET Feature Management
RimDev.AspNetCore.FeatureFlags
NFeature (GPL)
Feature Toggle (Apache 2.0)
Feature Switcher (Apache 2.0)
FlipIt (Apache 2.0)
Software as a Service Application Frameworks
Esquio
Platform as a Service
27. Blast radius of feature flags state
Same principles as deployment
28. Pipelines with approval and gates for flags
Gates
Check performance
metrics and alerts
Allow or disallow
next stage by
approval
Gates
Check performance
metrics and alerts
31. A|B testing (aka split testing)
Combine feature flag with experiment led by hypothesis
Increase percentage that has feature enabled
Measure results, outcome and gather feedback
Previously: Routing to two different implementations
Now: Percentage filter in single implementation
33. Smells
Too many flags
Flags used in multiple places
Fine grained toggles
Toggling business value vs
technical capabilities
34. Pitfalls
Combine feature toggles
Complexity
Dependent flags (one flag depends on other one)
Long lived
Launching in the blind (no monitoring)
Unseparated control
Don’t describe what toggle does
Repurposing feature flags
35. Best practices
Avoid flags as long-lived functionality
Separate flag management from app
Monitor usage of flags
Enable just one toggle at a time
36. Tips and recommendations
Add hardcoded fallback
Start with master flags and add smaller flags later
Define naming convention for flags