Feature flags — which enable developers to hide a feature, provide access to limited, users or execute a kill switch — are gaining new attention in the age of continuous integration and continuous delivery.
As CI/CD pipelines become ever more complex, feature flags, also known as feature toggles, provide an alternative to maintaining multiple source-code branches. Charity Majors, co-founder and CEO of platform-agnostic DevOps monitoring tool Honeycomb.io, recently pointed to feature flags as one of five emerging techniques used to manage serverless testing in production. She describes it as a way to say, “‘Don’t send anyone to this code until I say so,” and gave a shout-out to Oakland, Calif.-based LaunchDarkly.
It involves putting a flag in the code saying, “If you meet these criteria, I’m going to show you this thing. And if you don’t, I’m not,” he said. There are attributes that have to be met. Every time this is encountered in code, it checks values in the database. If it meets the criteria, it executes the code. With SaaS applications, this type of lookup has become very standard.
It enables customers to target users, do controlled rollouts and A/B testing without re-deploying the application. Users can turn certain functions on or off for different countries or groups of clients. If things go really badly with a feature, it can be killed as easily as flipping a light switch, Zimman said.
Companies traditionally have built and maintained systems to manage who has access to what code, he said, but because they’re not core to the business, these projects tend to lack resources and not be well maintained.
Co-founder and CEO Edith Harbaugh in a post at InfoQ pointed out that feature flags, when not well-maintained, can go very wrong. LaunchDarkly built its business on taking on that challenge for customers. It’s gaining traction on extending those controls to folks on the business side, such as marketing, as well, Zimman said.
“We have taken the internet meme of test in production and made it a best practice. Because the feature flag has this concept of isolation, it can control who can see what’s there, we have the ability to eliminate risk from running incomplete code in a production environment,” Zimman said.
LaunchDarkly has been focused on the developer experience — making onboarding quick and easy — and requiring minimal or no overhead for using the service in the application.
“As soon as [developers] have a concept for a feature or update a feature, they can create a feature flag, create this gate. Put that in LaunchDarkly, every time it encounters that code, it will know what to do,” he said.
When the application starts up, there’s a one-time communication with the service, which loads the values into the application for its use.
If the developer changes those values while the application is running, it uses server-sent events (SSE), a protocol for one-way real-time messaging, to send messages to your servers and pushes those values down to all the application endpoints. Changes are available in 200 milliseconds or less, he said.
Its webhooks API allows you to build your own integrations that subscribe to changes in LaunchDarkly.
LaunchDarkly uses multiple databases on the back end, including MongoDB, Elastic, Postgres and Redis, using the database appropriate for the values stored, Zimman said. The company built its own streaming protocol and uses the content-delivery network Fastly for distribution.
All flags are stored locally so that even if the CDN goes down, your servers will continue operating with the last set of feature flag rules. Its enterprise users can create custom roles, similar to the AWS Identity and Access Management (IAM) system, and custom goals, such as click and page view goals.
Going forward, the company is looking to provide more control points to developers, operators and business users, and automating the process in the workflow and providing better feedback along the way, Zimman said.
Customers include GoPro and TrueCar. Atlassian highlighted LaunchDarkly at its user conference last fall, and recently announced teaming up with LaunchDarkly and Rollout to bring feature flagging integrations into Jira Software.
Feature image via Pixabay.