Sharing application configuration value between workers?

Assume that I have two workers, A and B on the same account and zone, and they need to share some application configuration data between them. The use-case is whenever that configuration changes in A, B would need the new value instantly, without me having to go and manually make the change in B (and possibly C, D, E… etc). It’s important that all the workers have the same value that is always 100% in sync with each other. Ideally this could happen via a single Environmental Variable or Secrets setting that would be visible to multiple workers. Is it possible?

Not something CF does currently for workers. Your best option would either be a durable object (I think, haven’t played around with them yet) or a configuration KV namespace that’s attached to all workers that need it.

From a performance and/or cost perspective in CloudFlare, is better to create “monolithic” workers, where for example A and B features are deployed into a single Worker, or to deploy them into separate more specialised Workers? I’m thinking maybe the solution is to combine features into a single bigger Worker so they can access the same Evironmental variables.

I merged several workers up to one 1Mb monolithic workers, the cost is the same but easier to maintain.

1 Like