danschultzer

danschultzer

Simple feature flags in Elixir

I wrote a post on how to implement a feature flag system and A/B testing in an Elixir app with no need for third-party services or libraries. I used this system in production with a relatively large platform.

I’m also getting into what I think is some pitfalls of A/B testing and what mindset we should have when building products, with this quote in mind:

When a measure becomes a target, it ceases to be a good measure

Most Liked

aicost_tools

aicost_tools

Rolling your own flags makes sense to me: a table plus a cached lookup covers most of what teams pay a SaaS for. I’d push the Goodhart point one step further for AI features, where an A/B test can happily optimise engagement while the per-request cost quietly climbs, so I like seeing cost per user right next to the conversion metric. Do you store assignments per user, or hash user ids on the fly?

danschultzer

danschultzer

Yes, I have been in companies that used feature flags through mixpanel and lanchdarkly, but in both cases it was used so lightly that it really didn’t make sense to me why it was not just hand rolled (which is what I then did for another company).

This is also why I haven’t had the need to cache the feature assignments. Instead of depending on a third-party API where I need to think about caching them, I can calculate them on the fly instantly. I think even if the feature flags were loaded from the db it would still be minimal perf penalty to do it on the fly. The only scenario I can think of where storing them per user makes sense would maybe be in an edge case where I need to guarantee that the features are exactly what they were calculated at a specific time.

Missing the increase in cost per user while optimizing for an engagement metric is a great one.

Where Next?

Popular Backend topics Top

AstonJ
This article was written by @rvirding …over a decade ago! Posting here in case anyone else finds it of interest and adding it to our Erla...
New
First poster: bot
Part 1: Introduction to Postgrest. In Codd, we trust In the field of Computer Science and Engineering, few things come close to the dura...
New
CommunityNews
Idioms for the D Programming Language This thread was posted by one of our members via one of our news source trackers.
New
AstonJ
Just listening to this now… Totally agree with @FrancescoC’s and @thompson_si’s comment “learn to learn” :sunglasses: In our talk we’...
New
CommunityNews
Have you ever wanted to write a structurally typed function in Rust? Do you spend a lot of time and effort getting your Rust struct s jus...
New
pablocostass
Todos coñecemos os focos de Erlang/Elixir máis renomeados do mundo, como a Suecia, o Brasil, a California ou Londres. Mais a comunidade, ...
New
First poster: bot
Our blog has had a long standing interest in novel uses of the BEAM, or Erlang virtual machine, as shown by the many articles we have pub...
New
RudManusachi
Hi there! Recently I was playing around with extracting and updating data in the DB and for fun challenged myself to try to implement a ...
New
T0ha666
In this article, we discuss how to create a Docker image for a Phoenix application.
New
vkatsuba
Hi folks! Ukrainian Erlanger is here :sign_of_the_horns:! I’d like to share my recent talk at the TADSummit Online Conference, where I ...
New

Other popular topics Top

Margaret
Hello everyone! This thread is to tell you about what authors from The Pragmatic Bookshelf are writing on Medium.
1147 29994 760
New
PragmaticBookshelf
Use WebRTC to build web applications that stream media and data in real time directly from one user to another, all in the browser. ...
New
AstonJ
If you want a quick and easy way to block any website on your Mac using Little Snitch simply… File > New Rule: And select Deny, O...
New
New
PragmaticBookshelf
Leverage Elixir and the Nx ecosystem to build intelligent applications that solve real-world problems in computer vision, natural languag...
New
PragmaticBookshelf
Project retrospectives help teams examine what went right and what went wrong on a project. But traditionally, retrospectives (also known...
New
CommunityNews
A Brief Review of the Minisforum V3 AMD Tablet. Update: I have created an awesome-minisforum-v3 GitHub repository to list information fo...
New
AnfaengerAlex
Hello, I’m a beginner in Android development and I’m facing an issue with my project setup. In my build.gradle.kts file, I have the foll...
New
mindriot
Ok, well here are some thoughts and opinions on some of the ergonomic keyboards I have, I guess like mini review of each that I use enoug...
New
CommunityNews
Open-source implementation of the classic GTA engine now running directly in your browser. Experience the reVC technology demo on DOS.Zon...
New