If the workflow executes for a long time (for example, the workflow executes sleep), will a large number of coroutines be generated?
Asked
Active
Viewed 102 times
0
-
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 05 '22 at 09:30
1 Answers
0
Cadence or Temporal workflow only needs a worker to generate the next steps to execute. When it is blocked waiting for an external event like a timer it doesn't consume any worker resources. So a single worker can process a practically unlimited number of workflows given that it can keep up with their execution rate.
As an optimization workflows are cached on a worker. But any of them can be kicked out of cache at any time without affecting their correctness.

Maxim Fateev
- 6,458
- 3
- 20
- 35
-
Maybe I didn't make it clear, what I mean is that when the workflow execution is very slow and many workflows are started at the same time, a large number of coroutines will be created in this case, which is also resource consumption. – ericqzhao Jul 05 '22 at 02:37
-
A single worker can be configured to limit the number of parallel tasks executed. So the worker resources will not be exausted. You have to provision enough workers to keep up with the load. – Maxim Fateev Jul 05 '22 at 17:44