-
Can I still use Task.WhenAll() when I need to execute tens of thousands activity functions of times? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
It's possible to fan-out/fan-in tens of thousands of activities using a single A simple alternative that addresses these problems in a fundamental way is to break up your big orchestration into smaller orchestrations. For example, if you need to run 100K activities in parallel, you can create 100 sub-orchestrations from your main orchestration, each of which fans out to 1K parallel activities. This provides better overall distribution of memory and CPU used by orchestrations across all nodes, removing the bottleneck I mentioned earlier. Looping is also an option, but it doesn't solve the high memory usage problem and will result in higher overall latency since you're not taking as much advantage of parallelism. However, it has the advantage of being simpler to implement and may reduce the overall load across all your VMs. |
Beta Was this translation helpful? Give feedback.
It's possible to fan-out/fan-in tens of thousands of activities using a single
Task.WhenAll()
. We do this in our own internal performance tests using "Hello, world"-style activities. A downside to doing this are that the orchestration may become a bottleneck for overall throughput. It may also have a big memory impact on your app if the orchestration has to keep all the activity results in memory in order to complete. Using extended sessions can be helpful to mitigate some of these problems if your activity functions are short-lived.A simple alternative that addresses these problems in a fundamental way is to break up your big orchestration into smaller orchestrations. For example, if yo…