Decoupling Deployment from Release with Feature Flags

By
Cassandra Polzin
on
September 23, 2021

Imagine you’re a few weeks out from a new feature release when you find out it was accidentally pushed live to all your users in a testing mishap. Worse, there are still a few bugs you haven’t been able to work out, which your entire userbase is now subjected to.

That scenario is pretty much a developer’s worst nightmare. So how can you avoid it? By employing feature flags, which enables decoupling deployment from release. 

When Facebook was beginning to launch its chat functionality, they needed a way to test out the new features to ensure they worked before deploying to their massive userbase. Instead of using a test environment, Facebook deployed their new chat feature to their application environment with one caveat: the users couldn’t see any changes! This allowed Facebook to test internally and monitor the capacity of its servers before putting users at risk. That was new when Facebook launched it, now Flagsmith helps any team easily employ the same practice!

How can feature flags decouple deployment from release?

A key benefit of using feature flags in development is the ability to decouple feature deployment and release. Achieve continuous deployment by deploying behind flags, and then only toggling them on when a release is scheduled.

Deployment involves pushing code to your infrastructure or runtime environment. Release has to do with exposing code to execution or making it available for users. By decoupling deployment from release, you can deploy updates regularly and release features to your users at any time. As a result, you can gradually release new features to your user base, instead of rolling them out all at once. Meanwhile, you’re able to reduce the size of changes made with each deployment by making smaller updates far quicker. Feature flagging enables decoupling by telling the program which features should be available to whom, and when they should be made available.

What are the benefits of decoupling deployment from release?

There are a few key benefits of using feature flags to decouple deployment from release. 

Enhanced Testing

Using feature flags enables enhanced testing and monitoring capabilities. Instead of testing in a sandbox environment or just hoping your feature will work upon release, you can deploy your code first, in production, then release it to a subset of your users. From there, you can monitor application and user performance to determine if you’ll roll out further or roll back the latest feature.

Get Feedback Early & Often

It’s imperative to have fast and early feedback to ensure a stable feature. Decoupling deployment from release also enables capacity planning and management by allowing your team to start small and grow as risk is reduced. Your team can test features for as long as they need to feel completely comfortable at each stage of the rollout. You can start by rolling new features out to your dev team first, where there’s no risk, then to the rest of your internal team, and so on until you’re ready to release to higher-risk users. Since you’re deploying smaller updates faster, the bugs you need to fix will also be smaller and more manageable.

Monitor Capacity & Resource Planning

It can be difficult to anticipate traffic and usage volumes that may impact your hardware needs. With feature flagging, if something goes wrong or performs in an unexpected way, it’s easy to “unexpose” code to execution. As more users gain access to the feature, you can monitor performance closely to ensure your capacity isn’t at risk.

From a business perspective, your sales and marketing team benefit from decoupling deployment as they are able to better time their efforts, ensuring your team is aligned across the board.

Easy Feature Rollbacks

In the event that anything goes wrong, decoupling deployment from release makes it easy to roll back updates without needing to rush an emergency fix. If something goes awry, you can use a “kill switch” to revert back to before updates were made.

This has an added benefit of allowing you to continuously progress in your code commits, rather than having to remove the code at issue. This way one issue doesn’t stop the whole development path, which can always move forward.

Launch Faster

Perhaps most notably, you’re able to get code to production sooner. By decoupling deployment and release, you can conduct more seamless and foolproof testing before releasing features to your entire userbase. This will allow you to work out bugs faster and release them confidently when you’re ready. Further, users don’t need to download anything in order to see updates — they’re pushed out instantly with zero downtime.

Enabling Trunk-based Development

Trunk-based development is a software development strategy where developers commit to a main trunk branch Each new update is a branch, which after testing, can be merged into the main trunk. This is another strategy for decoupling deployment from release that minimizes risk by ensuring thorough testing opportunities are provided for each new release before it’s committed to the main application.

Developers can be comfortable committing code to the main trunk branch; their features are hidden behind flags. This is one of the main benefits of decoupling deploy and release. 

Learn more about trunk-based development using feature flags.

What are the drawbacks of decoupling deployment from release?

There are very few drawbacks to decoupling deployments from release. While doing so does add a bit of overhead, utilizing feature flags to reduce your risk and enhance the user experience is well worth the investment.

What mistakes should new developers avoid making?

Oftentimes, developers may have a negative experience with decoupling deployments from release which makes them hesitant to do so in the future. Avoiding these mistakes can help ensure you see the best possible results with feature flags.

Don’t create too many spurious flags.

Overusing feature flags is a cause for concern. Only build flags for new features you’re testing and avoid creating multiple where one would suffice.

Clean up your flags as you go

Don't let old flags hang around. Remove the conditional statements from your code and remove the flag from Flagsmith. Never stop refactoring!

Don’t start with low-risk parts of the codebase.

Don’t wait to build up to high-risk features. Feature flagging is even more beneficial when implemented with high-impact parts of your code.

Avoid developing complex user groups.

Don’t get too deep into user segmentations when you’re getting started. Especially if you have a smaller userbase, you may need to build broader segments for testing.

How can Flagsmith improve feature releases?

Flagsmith makes it easy to implement feature flags anywhere in your application. Launch new features to a subset of your user base effortlessly, then monitor the performance remotely, without worrying about deploying new code.Learn more about feature flagging with Flagsmith and get started for free.

Quote

Subscribe

Learn more about CI/CD, AB Testing and all that great stuff

Success!
We'll keep you up to date with the latest Flagsmith news.
Must be a valid email
Illustration Letter