简体   繁体   English

.NET工作流并行执行

[英].NET Workflow parallel execution

I have created Workflow and I have my code activity which is doing expensive query. 我已经创建了工作流程,并且我的代码活动正在执行昂贵的查询。 I want make execution of my activity (TagData) in Parallel. 我想以并行方式执行我的活动(TagData)。 But for some reason this 'ParallelFroEach' block is working as simple ForEach loop and does not execute it in parallel. 但是由于某种原因,这个“ ParallelFroEach”块像简单的ForEach循环一样工作,并且不能并行执行。 Why? 为什么? Do I missed something? 我错过了什么吗?

在此处输入图片说明

Thanks! 谢谢!

It all depends on how the TagData activity behaves. 这完全取决于TagData活动的行为。 If this activity is async and it does I/O (as I suspect it does) then you will see multiple TagData activities working at the same time albeit on the same thread. 如果此活动是异步的并且执行I / O(我怀疑是这样),那么您将看到多个TagData活动同时在同一线程上工作。 Workflows only have one thread of execution. 工作流只有一个执行线程。 That is why it is important to do async wherever possible. 这就是为什么尽可能进行异步很重要的原因。

For more information see The Workflow Parallel Activity and Task Parallelism 有关更多信息,请参见工作流并行活动和任务并行性

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM