优化 200 个请求的 Windows WF 3.5 实例创建
我目前有一个流程,可以为客户拥有的每个帐户创建一个 windows wf 3.5 实例。
foreach (Account acct in Customer.Accounts)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param.Add("account", acct);
//create the workflow instance
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(AcctWorkflow), param);
//start and run the workflow
instance.Start();
scheduler.RunWorkflow(instance.InstanceId);
}
目前每个请求的创建时间约为500ms,但给定200个账户,总时间> 1分钟
这是当用户单击创建请求按钮时实时创建的。
请告知我是否还有其他事情可以做,以使其更快。
I currently have a process that creates a windows wf 3.5 instance for each account that a customer have.
foreach (Account acct in Customer.Accounts)
{
Dictionary<string, object> param = new Dictionary<string, object>();
param.Add("account", acct);
//create the workflow instance
WorkflowInstance instance = workflowRuntime.CreateWorkflow(typeof(AcctWorkflow), param);
//start and run the workflow
instance.Start();
scheduler.RunWorkflow(instance.InstanceId);
}
currently the creation of each request is about 500ms, but given 200 accounts, the total time > 1 min.
this is created real time as the user clicks on a create request button.
Please advise if there is any thing else i can do to make it faster.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不确定 WF3.5 可以做些什么来加快速度。 WF3.5 运行时引擎有许多固有的“缺乏优化”问题,这些问题无法修复或解决(尤其是循环结构(例如 While 活动)的实现方式)。
如果它对您的项目可行,您确实应该考虑将其重写为 WF4。 WF4 的运行时引擎经过完全重写,充分考虑了大型+快速工作流程。请参阅http://msdn.microsoft.com/en-us/library/gg281645。 aspx 进行 WF3.5 与 WF4 运行时引擎的速度比较。
即使无法将工作流程重写为 WF4,您也应该更新为使用 4 引擎运行 3.5 工作流程(通过 WF4 Interop 活动)。与使用 WF3.5 引擎相比,这仍然可能使您的速度加倍。请参阅上面链接的页面底部,了解使用互操作活动的比较。
I'm not sure what can be done for WF3.5 to speed things up. The WF3.5 run-time engine has many inherent "lack of optimization" problems that just can't be fixed or worked around (especially the way looping constructs, such as the While activity, are implemented).
If it is feasible for your project you should really consider re-writing it into WF4. The run-time engine for WF4 is a complete rewrite with a strong consideration for large+fast workflows. See http://msdn.microsoft.com/en-us/library/gg281645.aspx for a speed comparison of the WF3.5 vs WF4 run-time engines.
Even if it is not possible to rewrite your workflow into WF4, you should update to run the 3.5 workflow using the 4 engine (via the WF4 Interop activity). This could still potentially double your speed over using the WF3.5 engine. See the bottom of the page of the link above for the comparison using the Interop activity.