-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
When a rollout/deployment occurs, the feature flags that are cached in ETS are all flushed (as a new node will start up without the same data). This leads to a Thundering Herd situation, as all of the requests to the new node make requests to the persistence adapter (until the cache fills once more).
This can be solved in a few different ways:
- Pre-filling the cache: on startup, allow a configuration that will pre-fill the ETS cache in memory. This will ensure that the cache is already full after startup completes. This could cause bloated memory, if for example the feature flags table contains a lot of old flags that are no longer in use.
- Single-flight mechanics: Using a single-flight mechanism to ensure that only one request per key to the persistence adapter is made at any given time. This is fairly easy to implement with a GenServer +
handle_call
+GenServer.reply
, i.e. thepersistence_adapter().get()
call would be wrapped in a GenServer to ensure that only one call is running at any given time.
Metadata
Metadata
Assignees
Labels
No labels