Live data from Hacker News

Ask HN: Does your team use feature flags?

news.ycombinator.com

111–120 of 143 posts

Re: Ask HN: Does your team use feature flags?

#111
post #67

Earlier quoted context omitted.

Build a service/loop/CI/cron job/whatever to pull feature flag state from prod and check into your relevant branch(es). Make the dev deployment apply this state by default. You’ll get a lot of extra value out of this if you have an automated test pass that exercises the bulk of the product. You get bonus points if you can integrate individual feature flags back to your branch(es) independently, because it will let yo…

This makes sense, thanks for this set of ideas. Have you implemented this, or seen write-ups of this pattern described at length? Or perhaps commercial products providing for this scenario? Curious about prior art on this subject.

My team has basically implemented this twice, for two different products.

One (product A) does individual integrations from the production feature flag system to the repo when the flag is at 100% in production. It’s quite successful.

The other (product B) does bulk integration every few hours from production to the repo, bringing all flags at once. It enables flags that have been “approved” (as opposed to fully enabled in production). It’s less successful because of the bulk behavior, which makes it more difficult to isolate breaks.

Both of these integrations go through the same validation gates as pull requests (they are actually implemented as pull requests). This ensures that flag changes through this system cannot break pull requests.

The ideal system for protecting pull requests (or whatever other validation) is to require validation to pass before the flag can be enabled in production. I have not implemented this as a hard gate, but I do have an “fyi” validation run as post of the flag enabling for product A so engineers see if they’ve broken something before they start turning on the flag.

Getting philosophical, I strongly believe that feature flags should not be enabled by default in the validation environment until they are fully enabled (or close to fully enabled) in production. This ensures that the base state (flag off) is validated. You always want it to be safe to turn off the flag, which means you want validation running with the flag off. Product B does not have this behavior for legacy reasons but I think it’s a poor technical decision.

Re: Ask HN: Does your team use feature flags?

#112

Earlier quoted context omitted.

A/B testing can be done with feature flags. Gradual rollout, specific customer opt-in, and so on.

I guess you could do A/B testing with feature flags but honestly, it won't be any good. If you want a good answer if to go with A or B, you want to have many data points, not just from one specific customer. Gradual rollout and specific customer opt-in to certain features can certainly be done with feature flags, I wouldn't call that A/B testing unless you're running experiments and reaching a conclusion that A is be…

You can totally implement A/B tests on top of a feature-flag framework. Your “pass” function should be hashed on the User ID/Cookie/whatever and then you can distribute users into pass/fail. You should do this anyway for reproducibility. If you log whether they passed/failed and then have metrics, you compute experimental results.

Re: Ask HN: Does your team use feature flags?

#113

How do folks implement feature flags? Do most people use feature flags as "remove/add code from/to my application at compile time"? Or do people also use some kind of a runtime check system that enables them to toggle functionality while the application is running with some partial reloads or fast restarts?

Curious about this as well

Re: Ask HN: Does your team use feature flags?

#114
At my previous job we used them. Sometimes it was to enable/disable features for customers that were part of a beta program. These could eventually evolve to be controlled by ad admin as we rolled out the feature to all customers.

The product was a desktop file synchronization client. We had an API that we would get administer-controlled settings. Feature flags were usually part of that API.

We don't use them at my current job, but it's a much smaller company with many less customers.

Re: Ask HN: Does your team use feature flags?

#115

How do folks implement feature flags? Do most people use feature flags as "remove/add code from/to my application at compile time"? Or do people also use some kind of a runtime check system that enables them to toggle functionality while the application is running with some partial reloads or fast restarts?

   if FEATURE_FLAG_ENABLED():
       do_new_version()
   else:
       do_old_version()
all throughout code. "FEATURE_FLAG_ENABLED()" could be checking a database or an external service. I've also seen it done through environment variables, but I don't like that pattern as much.

Re: Ask HN: Does your team use feature flags?

#116

How do folks implement feature flags? Do most people use feature flags as "remove/add code from/to my application at compile time"? Or do people also use some kind of a runtime check system that enables them to toggle functionality while the application is running with some partial reloads or fast restarts?

Mobile app case here:

The app fetches its base configuration first from a known URL, before even loading anything except for the most essential parts.

This is where we can disable the most basic level of operations or do an emergency shutdown of the client (backend broken or front end exploit found for example)

Second level is a version-specific configuration, which can be used to disable all major features of the application.

Then there is a system that allows for A-B -testing of features on a client, which can also be used to completely turn off features. It's mostly used to slowly roll out features on the client that might stress the backend in unexpected ways if enabled in one go.

The A-B tests are either moved to the second level config feature flags, or permanently turned on or off in a subsequent release.

Re: Ask HN: Does your team use feature flags?

#117
Every developer makes a rollback-worthy mistake every x changes. This means your probability of having a clean release is (1-1/x)^NumDevs EDIT - Assuming everyone submits 1 change/release.

Let's give it 1/100 bad code change, and 100 devs. The probability of a clean push is:

(1-1/100)^100 = 0.36. That's worse than a coin flip.

for 10 devs = 0.90. Still not great, one push in 10 will be bad.

When you're trying to push daily (or even more frequently), this will kill the team's velocity. It's even worse when there are interleaving changes making rollback and re-release impossible before the next release. Rollback and freeze is a problem when you're trying to meet deadlines (either marketing or regulatory).

Feature flags allow the code to go in and each change to be rolled back independently. This lets the rest of the team to make progress while the bug is debugged.

Short release pipelines could be a solution, but they're aren't necessarily sufficient. Time to recovery when there isn't a feature flag is also problem.

For example, some bugs take days/weeks to reveal themselves (think month end), so a "30 min build and full push" is not enough of a guarantee. Time to recovery needs to consider the time to find the change and roll it back, including dealing with any interleaving changes that happened in the meantime.

Re: Ask HN: Does your team use feature flags?

#119
Midsize SaaS here -- we switched from feature branches to feature flags a couple of years ago; major improvement in our process. Once or twice we've been tempted into foolishly "just this once" working on something out of a feature branch instead, and it always always always leads to messy merge conflicts.

Our React app just uses a simple home-rolled set of keys in localStorage; we have a "secret" route that lets users turn their own flags on or off, and we encourage developers to duplicate big chunks of code while working behind a flag instead of mixing old and new, to make cleanup easier.

(And yeah, someone does have to stomp around every few months and remind everyone to clean up their dead code again. Still worth it.)

Re: Ask HN: Does your team use feature flags?

#120
post #111

Earlier quoted context omitted.

This makes sense, thanks for this set of ideas. Have you implemented this, or seen write-ups of this pattern described at length? Or perhaps commercial products providing for this scenario? Curious about prior art on this subject.

My team has basically implemented this twice, for two different products. One (product A) does individual integrations from the production feature flag system to the repo when the flag is at 100% in production. It’s quite successful. The other (product B) does bulk integration every few hours from production to the repo, bringing all flags at once. It enables flags that have been “approved” (as opposed to fully enabl…

Thank you for sharing these details.
Post reply on HN