Hi! I have a question about Temporal worker scalability, feel free to point me to the docs if something already exists around this. I have a case where I need to fan out a large number of activities (thousands) of the same type, in a single workflow invokation, and I do so using the Java SDK, something like: Promise.allOf(promisesList.values).get()
. I have a few questions:
- Will this immediately enqueue all these tasks to the task queue?
- If I only have a single worker, can the worker process these in parallel, or will they be sequential? It looks like
DEFAULT_MAX_CONCURRENT_ACTIVITY_EXECUTION_SIZE
is 200 by default for a worker, does it mean that the worker can process up to 200 of these tasks in parallel (assuming no other workload on the queue)? - When I look at the event history, it leads me to believe that the answer to the above is that “they will be sequential” - I don’t see, for example, 200 “ActivityTaskScheduled” back to back - they mainly seem to be scheduled → started → completed, then the worker moves to the next one. I have trouble reconciling that with the config of 200 max activities?
- Say that the code above gets executed and ~1000 activities get queued, and assuming a different workflow comes right after and invokes a single activity, am I correct in assuming that this activity will get queued behind the 1000 others, and potentially starved, thus leading to a timeout?
- Say, hypothetically speaking (ha!) we’re in this boat, would the recommendation be to horizontally scale by adding a second worker, or vertically scale and increase max concurrent activity if our worker still has spare cpu/memory? If the latter, then I’m having trouble reconciling how that number comes into play given I don’t see much parallelism in the event history of a workflow running on a single worker.
I’m sure I’m missing something - any guidance would be appreciated, thanks!