What Are Feature Flags?

890
What-are-feature-flags-why-and-how-to-use-them-LaunchDarkly

The who, what, where, when, and why of feature flags

When getting started with a new concept, you may have lots of questions. This article will cover:

  • The definition of feature flags.
  • The types of companies and teams using feature flags.
  • Benefits of feature flags.
  • Feature flag use cases.
  • Feature flag deployment options.
  • Feature flag success stories.

What is a feature flag?

A feature flag is a software development technique used to enable or disable functionality remotely without deploying code. New features can be deployed without making them visible to users. Feature flags help separate deployment from release letting you manage the full lifecycle of a feature.

Feature flags go by many names:

  • Feature toggle
  • Feature flipper
  • Conditional feature
  • Feature switch
  • Feature controls

What-is-a-feature-flag-LaunchDarklyWhatever their name, the purpose is to use known information to control how code works. For example, if new features are made available to internal users for testing and feedback, a feature flag can control this access. Any employee logged into the application with a corporate email address will see the feature; other users do not.

Feature flags eliminate the need to maintain multiple feature branches within your source code. All merges can be made to the primary branch, only when the feature is ready will it be enabled via the flag.

Who uses feature flags?

Feature flags aren’t just for engineering teams. Flags can be used by:

  • Sales and Customer Support to provision entitlements.
  • Product Management to manage beta programs.
  • Marketing to run A/B tests.

Feature management is commonly used at companies of all sizes and across all verticals looking to:

  • Reduce the number of code rollbacks.
  • Gradually roll out new functionality to users.
  • Minimize the risk of a release.
  • Test user acceptance.

Companies utilizing continuous integration/continuous delivery (CI/CD) or Progressive Delivery rely on feature management practices to gradually roll out features to users. Continuous delivery is the ability to shorten release cycles and get new functionality in the user’s hands quickly and safely. Progressive Delivery kicks it up a notch and provides fine-grained control over the rollout and ownership of a feature. Progressive Delivery includes user segmentation, traffic management, observability, and automation to release features to small portions of users.

Through these delivery processes, teams develop a cadence for lean releases, where new functionality is wrapped in feature flags. Features are gradually rolled out to users to validate their integrity and minimize the risk to your platform and company.

Why use feature flags?

The Accelerate: State of DevOps Report outlines the characteristics of high performing organizations. Compared to low performing teams, high performing teams deploy code 46 times more frequently with a lead time from commit to deploy 2,555 times faster. Not only are they deploying code faster, they fail less frequently. High-performing teams have a lower change failure rate and recover from incidents faster. Part of what makes this possible is having the right systems and processes in place to support your teams.

why-use-feature-flags-LaunchDarkly

Creating a CI/CD pipeline is necessary to deploy code multiple times a day. CI/CD is about getting software delivered to end-users faster. To move quickly, you need safety measures in place. Feature flags are one of those safety measures. With feature flags, you can turn off a feature that performs unexpectedly in production without rolling back the code.

Feature flags also assist with teams using trunk-based development. Trunk-based development is when developers commit code to a single branch referred to as a trunk (or master) rather than long-lived feature or development branches. A single branch of code helps to eliminate merge conflicts and broken builds. Instead of using a feature branch, use a flag to gate features not ready for public viewing.

When to use feature flags

There are four main categories of when to use feature flags.

Improve build and release processes (release management)

Using flags as part of your build process is one of the most common uses of feature flags. Release management includes early access programs, canary releases, and beta programs—anywhere you give a select group of users access to features before releasing the feature to everyone. Starting small and rolling out to larger groups over time helps you:

  • Observe the behavior of the systems and services under increasing load.
  • Collect user feedback and make changes if you need to.
  • Limit the blast radius if something goes wrong.

release-management-1-LaunchDarkly

Operational efficiency

Feature flags can manage and control the behavior of system disabling to minimize the impact of incidents. Using operational feature flags you can:

  • Deploy circuit breakers or kill switches to programmatically or manually disable a feature if it behaves unexpectedly and alerts are triggered.
  • Limit API requests to ensure API reliability.
  • Switch to a less feature-rich version of a page under heavy load.
  • Test new microservices or third-party tags in production for interoperability testing.
  • Change log-levels on the fly for debugging purposes.

operations-feature-flags-1-LaunchDarkly

Learn from experimentation

A large part of building and operating software is learning what works and what doesn’t. Experiments are one way of learning about our software, infrastructure, users, and systems. Experiments include concepts such as A/B testing, game days, or chaos experiments. They allow you to gain new knowledge. Using feature flags, you can test different configurations of a feature to validate or disprove gut feelings. Experiments provide concrete reporting and measurements to ensure that you are launching the best version of a feature that positively impacts company metrics.

experimentation-metrics-LaunchDarkly

Empower teams with entitlements

In software, entitlement refers to the right to use services, products, or features. Entitlements define the features each user can access. Entitlements are sometimes referred to as paywalls, as features are only available to paid subscribers.
Feature flags, in the context of a feature management platform, can empower others in the organization to manage and control entitlements. This results in better customer experiences and greater operational efficiency.

entitlements-LaunchDarkly-1

Where feature flags make a difference

Looking for inspiration on where you can use feature flags? Check out these unique examples.

A restaurant chain deployed feature flags to switch between POS vendors if it crashed or became unavailable, thus minimizing lost revenue and unhappy customers when orders could not be processed and paid for.

At a SaaS company, assigning support tickets was often a manual process. Feature flags were used to determine the capacity of technical support engineers and leads. The engineer with the most capacity is assigned a ticket. Automating ownership based on capacity reduces the amount of time before a ticket is in the hands of a support engineer.

An automotive marketplace, when migrating from on-premises data centers to the cloud, needed to move data in small increments to check for errors. Feature flags helped them selectively route small percentages of traffic based on categories.

How are feature flags deployed?

How you choose to deploy feature flags depends on several factors including:

  • The size of your engineering team
  • How often you release code to production
  • How many flags you want to deploy
  • Whether you want to build vs. buy

Based on the above options, your options for deploying feature flags start with using a configuration file. Config files can be used to store global application settings. If a single feature needs to be “on” or “off” for all users, putting it in a config file is a straightforward way to deploy.

If you have more than a couple of flags or you need more granular controls, you may opt to deploy flags via a database. When you manage flags from a database, features can be targeted to individual users. You also can make modifications to user targeting without having to restart or re-deploy services.

You may opt to deploy using an open-source solution. Open source solutions allow for user segmentation, targeting, and controlled feature rollouts. Open source solutions are often language or stack specific. If your application uses multiple languages, as many do, you may need to deploy multiple solutions for complete coverage.

A final deployment option is to use an enterprise feature management solution like LaunchDarkly. When you have needs such as role-based access controls (RBAC), audit logs, or use cases including experimentation or entitlements, you would want to deploy a comprehensive feature management solution.

Why use LaunchDarkly for feature flags?

LaunchDarkly offers a feature management platform as a service designed for the entire organization. We believe the effective use of feature flags is an organization-wide endeavor, not something limited to a few developers. All teams across the organization can benefit from the use of feature flags. LaunchDarkly grows with you as your feature flagging practice expands from a single flag deployed by a single developer to team-wide use, to delegating control of flags to other teams to meet their use cases.

LaunchDarkly-dashboard-feature-flags-1

Request a demo of the LaunchDarkly feature management platform or start a free trial.