Feature Flags

https://pixabay.com/en/semaphore-flag-naval-navy-u-27031/
(Pixabay)

Darn, this thing called “software development” keeps changing, keeps advancing, and you have to keep reading in order to keep pace.  The topic today?  Feature flags/toggles.

One of the issues that we have is multiple teams (application development. application maintenance and more) accessing the same code base and making changes at the same time.  The problem is trying to merge changes from Project A into what Project B is doing while at the same time making sure that the team handling the main trunk, maintenance, isn’t left out in the cold.  This can be handled through branching and merging back into the source trunk, but it can be difficult if you have multiple projects going at the same or even if you have just two projects, but their deployment schedules aren’t firm.

The other way to do things is to use something called a feature flag.  In this model everyone works in the same codebased, checks in code all the time, but their feature, what they are working on, is not visible until their feature flag is turned on.  So, imagine this:  you deploy a new application into production on Tuesday, but make sure that the feature flag is off.  When Thursday comes and your boss says “Make it live”, you just need to turn a flag from “off” to “on” and you’re done.  No outage window.  When combined with a more services oriented architecture you have the opportunity to deploy when you want and make features availalbe when you want.

Perhaps you only want a feature available to certain people.  You can do that.  At certain times of the day?  You can do that.  Only to people whos last name contains a vowel in the second character.  You can do that!  Feature flags can ensure that features can be introduced and “backed out” at will, merely through changing a flag.  Imagine a feature not working properly, you just turn it off and the system acts as if it doesn’t exist.

OK, time to get excited.  You see where I’m going with this, don’t you?  By combining (micro)services, a leaner pipeline through the introduction of feature flags, you can introduce new technology very quickly, very easily, and do it using dozens or hundreds of different teams.

Does this work in real life?  Does anyone shop at Amazon?  The used to be monolithic, then they went services.  According to a 2015 presentation they do over 50 million deployments per year across all of their environments.  How do you think they get Amazon Prime day working properly?  Feature flags.  Turn it on at a specific time and turn it off at a specific time.  How do you think they fix problems that occur on a busy day?  Services.  Small changes made to small pieces of code and tested in an automated fashion.

None of this is new, it’s been worked on by some of the biggest companies and some of the smallest companies in the world.  It works.

Leave a Reply