Worker within microservice

Hi all!

This might seem as a basic question but I’m still trying to figure out the exact way of how we should set this up in a productive environment.

We currently have 9 micro services developed in different languages ranging from NodeJS to Python and J2EE. All microservices host API endpoints which are being used by the frontends (microapps). Microservices communicate via an event messaging system.

We want to use Temporal.io for certain processes that span multiple microservices. Is it best-practice to host the workers in each individual microservice (9 workers then) and host the APIs next to it as well? Or should we isolate the workers completely from the APIs?

We can scale out each microservice to setup multiple workloads but my worry is that the workers will block the main thread in our NodeJS microservices.

Thanks,
Bram

See How to let one workflow interact with multiple microservices - #3 by maxim

Thanks @maxim! I saw that post before but I have also been reading other blogs that say we should deploy and scale workers in an isolated fashion.

If we can compare workers as consumers of events (just like Kafka consumer of topics), then I’m not worried.

But I have been reading things that recommend deploying them separated so we just hoping to get a confirmation here that this is not needed and running them next to a ExpressJS for example is definitely not going to be a bottleneck.

I don’t think Temporal is much different from any other technology that uses some process resources. I would start by running it in the same process. If the process becomes overloaded, you can always move some logic out.

Thanks @maxim ! Much appreciated