Feature flags are commonly used constructs and have been there for a while. But in the last few years, things have evolved and feature flags are playing a major role in delivering continuous risk-free releases. In general, when a new feature is not fully developed and we still want to branch off a release from the mainstream, we can hide our new feature and toggle it off in production. Another use-case is when we want to release our feature to only a small percentage of users, we set the feature ‘on’ for a segment/geography and set it ‘off’ for the rest of the world. The capability to toggle a feature on and off without doing a source code change gives the developer an extra edge to experiment with conflicting features with live traffic. Let us deep dive into more details about feature flags and an example implementation in Springboot. 

Things To Consider When We Are Introducing a New Feature Flag

Establish a consistent naming convention across applications, to make the purpose of the feature flags easily understandable by other developers and product teams.
Where to maintain feature flags?

In the application property file: Toggle features based on environment. Useful for experimenting in development while keeping features off in production.
In configuration server or vault: Let’s imagine you are tired after a late-night release, and your ops team calls you at 4 am, to inform you the new feature is creating red alerts everywhere in monitoring tools, here comes the Feature toggle to your rescue. First, turn the feature ‘off’ in the config server and restart compute pods alone,
In database or cache: Reading configs or flag values from a database or an external cache system like Redis, you don’t have to redeploy or restart your compute, as the values can be dynamically read from the source at regular intervals, pods get updated value without any restart. 

You can also explore open-source or third-party SDKs built for feature flags, a handful of them are already in the market. They also come with additional advantages that help in the lifecycle management of feature flags. 

Leave a Reply

Your email address will not be published. Required fields are marked *