Orchestrating Multiple Workers

Hey everyone!

I’ve been researching CF Workers for a couple of weeks now as I’m interested in migrating away from AWS. I was wondering if one is able to deploy multiple services as CF Workers to the edge and have these Workers communicate with one another. Would all Workers deployed be deployed to the same location, thus making the communication between them fast? Is this an advisable architectural pattern for Workers, or is it recommended that Workers don’t communicate with other Workers? Thanks!

At the moment Worker-to-Worker communication can only happen if the two workers are in different zones. There is a beta for Durable Objects which allows same-zone ad hoc spawning of workers that also have extra storage features, similar to the actor model.

1 Like

Thanks for the response @jayphelps!

Do you know if one has the ability to change the zones of a worker to enable this type of orchestration?

Because of this I started to build many workers into a monolithic workers, that then runs the logic independently or interconnected. a function with functions.

2 Likes

Thanks for the response @adaptive! So you were able to run other Workers within your monolithic Worker?

A monolith means it’s all 1 code-base, so the functions call other functions inside a single call, do to do more work. But since that will run out of CPU-time quite fast, what I’ve done so far, until we have Durable Objects, is setup two domains. Domain 1 have the main functions, which then call domain 2 workers. It’s of course possible to have multiple different domains this way, each with it’s own worker.