Is it a good idea to run cadence workflows and activities on differnet deployable services?

24 Views Asked by At

I just came to a project where workflows and activites are deployed individually, which means every activity and workflow is registered in their own worker. This was probably done this way to improve scalability.

But I can't find this kind of architecture in the official documentation or in any other post. What I found is that activites and workflows are usually deployed together using the same worker in just one deployable service. Is this a better approach? What would be the pros and cons of doing it in just one worker?

2

There are 2 best solutions below

0
Long Quanzheng On

Pros:

  • better resource management (like cpu memory)
  • Isolation of deployment (less restart , memory leaked, history cache hit)

Cons:

  • more work to maintain
0
Silasvb On

Both have their pros and cons. You also have the option to deploy multiple workers on a single service, one worker per service, or scale up the number or multiple services for a single worker topic. It all depends on what your performance and scaling requirements are. I'd suggest starting with a single worker and only scaling when you need. The exceptions to this that you might want to consider are:

  • is there a benefit (for whatever reason) to have some activities/workflows implemented in Go and others in Java
  • are there specific workflows or activities that are performance bottlenecks
  • do you have multiple teams working on your infrastructure. If so, there may be benefits to each team having separately deployable workflows and applications.