You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for reusing data source from Puma master to worker processes with FDv2 #504
Is your feature request related to a problem? Please describe.
We run Puma in cluster mode which starts up a master process that does some start-up, and then forks N worker processes. If you're not using daemon mode, each worker process has its own separate in-memory cache and connection that it needs to initialize on start-up. If you have a lot of feature flags & segments this can add up in both start-up time and CPU/network IO that seems unnecessary.
Under FDv2 a client is able to resume a connection by passing in a Basis marker, meaning it only needs to download new events since it previously connected rather than downloading the entire state like in FDv1. If we are able to reuse the data store from the master in the workers that would prevent us from needing to re-download it on the workers.
Describe the solution you'd like
Right now a client breaks when you fork, as the stream and event dispatcher threads are gone. There's a warning in the SDK when you try to use a forked client that tells you to call LDClient#postfork. postfork discards all of the inherited data and runs start_up again, building a new, empty store with no basis. If a client is using FDv2 it should be possible to reuse that store and pass the basis when starting up the new stream thread.
I'm open to alternative implementations, this one just seems like the most obvious solution to me (a platform engineer who doesn't regularly work in Ruby)
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
Right now this should be technically possible with the SDK's existing extension points; writing a custom DataSystem intializer and passing in the inherited basis and selector store in to the new client in on_worker_boot, but I have not tried it to confirm that it worked. The ergonomics of it are sub-optimal, and there's no official documentation that this is supported, just my own analysis that this should work.
Additional context
Add any other context about the feature request here.
Our services use as many as 8 worker threads, and we have an embarrassingly large amount of data in LD, about 25 MB that each worker needs to download.
@clayton-sayer thank you for taking the time to open this issue. And yes, I agree with you, the forked workers should be able to pick up from the last known pre-fork state. That is an improvement we have been planning to make, but haven't yet had the chance to tackle.
I am planning on doing some more ruby work over the next couple of weeks, and can try to make this change. I will follow up here once I've made some progress.
Activity
keelerm84 commentedon Nov 23, 2026
@clayton-sayer thank you for taking the time to open this issue. And yes, I agree with you, the forked workers should be able to pick up from the last known pre-fork state. That is an improvement we have been planning to make, but haven't yet had the chance to tackle.
I am planning on doing some more ruby work over the next couple of weeks, and can try to make this change. I will follow up here once I've made some progress.