
Feature flags have emerged as a versatile tool in the arsenal of modern-day DevOps teams. At their core, these toggles serve as a switch that enables teams to turn specific features on or off within an application or system. This functionality makes feature flags indispensable for several reasons, including testing and experimentation, targeted rollouts, and gradual releases.
Use cases:
Testing and experimentation: Feature flags are an excellent tool for testing and experimentation. Teams can use them to turn specific features on or off, allowing them to test new features in a controlled environment before going public. This approach minimizes the risk of any negative impact on the overall system.
Trunk base development: Keeping the trunk always deployable is essential to practice continuous deployment; this demands wrapping of in-progress features under a feature flag.
Targeted rollouts: Feature flags are helpful for targeted rollouts, particularly for new features or updates. Instead of simultaneously releasing a new feature to all users, teams can gradually introduce it to a smaller subset of users. This approach allows for better control and testing of new features and minimizes the impact of any issues that may arise.
Gradual releases: Feature flags are an excellent tool for gradual releases, which can slowly introduce new features to users over time. This approach benefits complex systems, where minor changes can significantly impact user experience and performance.
A/B testing: Feature flags can be used for A/B testing, where two versions of a feature are released to different subsets of users. This approach allows teams to test which version of the feature performs better, allowing them to make decisions based on data about which version to release to the public.
Emergency rollbacks: If critical issues arise, feature flags can quickly roll back to a previous system version. This approach helps ensure that problems can be resolved promptly, minimizing user impact.
Best Practices
Naming & metadata: Contextual names with traceability to who owns the flag and details on the provided feature; a good strategy is to tie the flags back to feature definition in the project management tool.
Traceability to code: Feature flags should be traceable to the code they wrap; that way, we would understand the cleanup area during the removal of the flags.
Use a centralized management system: It’s essential to have a centralized system for managing feature flags. This system should provide a single source of truth for all feature flags, allowing developers to manage them efficiently and avoid conflicts.
Document feature flags: It’s crucial to document feature flags accurately, including their purpose, status, and configuration. This documentation ensures that teams understand the purpose and use of each flag and can avoid confusion or conflicts; these documents ideally should be generated during the planning phase.
Use Automation to toggle: Toggling should be part of the automation pipelines. If the flag is a scope to a release, it should be part of automated steps.
Test feature flags thoroughly: Before rolling out any feature flags, it’s essential to test them thoroughly to ensure they work as intended. The test suite should validate feature flag combinations.
Monitor feature flags: Continuous monitoring of feature flags is essential to quickly identify and resolve issues that arise, minimizing the impact on users.
Remove unused feature flags: It’s essential to remove unused feature flags to prevent confusion and avoid errors caused by unused flags; feature flags can become technical debt if not cleaned up at regular intervals.
Segment Users: Group users or entities for which we would want a variation of the flags; flag can serve a different value to a segment of users.
Security: Utilize the principle of least privileges, scope users to internal and external facing env, with the capability to view toggle and need approvals in customer-facing environments.
Use feature flags judiciously: Too many can lead to confusion, clutter, and performance issues. Therefore, it’s vital to use them only when necessary and to remove them when they are no longer needed.
# We utilized LaunchDarkly as our feature management platform.


