News for hackers. Stuff that matters.
Re:Flags vs. Gates by simonw on Saturday November 20, 2021 @06:48PM (#29292865)
I've run into the feature flag scaling problem before - where every front-end server needs access to the current state of the flags, which can be a pretty large amount of state to pass around if you support per-ID flags for hundreds of thousands or millions of users.

In the past I've solved this with a per-instance cache, but that's frustrating because it means that feature flag changes now take up to 5 minutes to roll out.

Next time I need to build this, I think I'm going to use SQLite for it.

A SQLite database on each front-end instance could model arbitrarily complex feature flag rules, and even with millions of potential turned-on-for-user-X records would still only be in the order tens of MBs on disk.

Checking flags would be a fopen() call and and indexed SQLite query, with no network overhead, so practically free.

The challenge would be synchronizing down the central state to these hundreds of separate SQLite databases. That doesn't feel insurmountable to me - just having a process that polls a central source every 10 seconds or so for changes to apply since their last update could probably work fine here.

Re:Flags vs. Gates by tantalor on Sunday November 21, 2021 @11:55AM (#29297706)
> if you support per-ID flags

Don't do that. That sounds more like user preferences, which feature flags are not meant to solve.

Feature flags are supposed to enable features for some x% of users, which you can do by something like `user_id % 100 < x` (no database query required).