[Question] In what order durable function process sub-orchestrator and activity function #2737
-
I have some questions about the theory of the order durable function process sub-orchestrator Sorry for my bad english |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 10 replies
-
The exact behavior depends on which storage provider you're using, but generally speaking, when you schedule sub-orchestrations and activities in parallel, there's no guarantee about the order they run in. Assuming you're using the Azure Storage provider, if you limit concurrency to just one worker and one concurrent orchestrator function like you described, they might run in the order they are scheduled, but it's not guaranteed. This is because we use the process's thread pool to schedule the parallel sub-orchestrations (or activities), so we can't guarantee what order in which the thread pool will add messages to the Azure Storage queue. The behavior might be different with something like the MSSQL storage provider because it adds all messages to the database in a single database transaction, so the order in which they appear in the database will always be consistent. However, it's best to not rely on this behavior since there are other factors that could possibly cause parallel orchestrations/activities to run in arbitrary order. |
Beta Was this translation helpful? Give feedback.
-
If you run one orchestration at a time by setting concurrency to 1 (and having only one app instance), then I expect that most of the time the order will be 1, 2, 3, 4, 5, 6, 7, 8, 10, 9. In other words, the order will be effectively "breadth first". |
Beta Was this translation helpful? Give feedback.
Yes, this is the expectation. I'll try to explain why: