高吞吐量和 Windows Workflow Foundation
WWF 能否处理同时“主动”并行处理数十条记录的高吞吐量场景?
我们希望构建一个每小时处理几千条记录的工作流程。 每条记录最多需要一分钟来处理,因为它会进行外部 Web 服务调用。
我们正在测试 Windows Workflow Foundation 来执行此操作。 但我们的演示程序显示,当我们使用并行活动在一个工作流实例中同时处理多个记录时,每条记录的处理似乎是按顺序运行而不是并行运行。
我们应该使用多个工作流实例还是并行活动?
是否有任何已知的高性能 WWF 处理模式?
Can WWF handle high throughput scenarios where several dozen records are 'actively' being processed in parallel at any one time?
We want to build a workflow process which handles a few thousand records per hour. Each record takes up to a minute to process, because it makes external web service calls.
We are testing Windows Workflow Foundation to do this. But our demo programs show processing of each record appear to be running in sequence not in parallel, when we use parallel activities to process several records at once within one workflow instance.
Should we use multiple workflow instances or parallel activities?
Are there any known patterns for high performance WWF processing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您绝对应该为每条记录使用新的工作流程。 每个工作流程仅获得一个线程来运行,因此即使使用 ParallelActivity,它们仍将按顺序处理。
我不确定 Windows Workflow 的性能,但据我在 Tech-Ed 上听到的有关 .NET 4 的消息,它的 Workflow 组件将比 .NET 3.0 和 3.5 中的组件快得多。 因此,如果您确实需要大量性能,也许您应该考虑等待.NET 4.0。
另一种选择是考虑 BizTalk。 但它相当昂贵。
You should definitely use a new workflow per record. Each workflow only gets one thread to run in, so even with a ParallelActivity they'll still be handled sequentially.
I'm not sure about the performance of Windows Workflow, but from what I have heard about .NET 4 at Tech-Ed was that its Workflow components will be dramatically faster then the ones from .NET 3.0 and 3.5. So if you really need a lot of performance, maybe you should consider waiting for .NET 4.0.
Another option could be to consider BizTalk. But it's pretty expensive.
我认为常见的模式是每条记录使用一个工作流实例。 工作流运行时并行运行多个实例。
一个工作流实例一次运行一个线程。 并行活动在此单个线程上顺序调用每个活动的 Execute 方法。 但是,如果活动是异步的并且花费大部分时间等待外部进程完成其工作,您仍然可以从并行活动中获得性能改进。 例如,如果活动调用外部 Web 方法,然后等待答复 - 它从 Execute 方法返回,并且在等待答复时不占用此线程,因此并行组中的另一个活动可以开始其工作(例如,也调用网络服务)同时。
I think the common pattern is to use one workflow instance per record. The workflow runtime runs multiple instances in parallel.
One workflow instance runs one thread at a time. The parallel activity calls Execute method of each activity sequentially on this single thread. You may still get performance improvement from parallel activity however, if the activities are asynchronous and spend most of the time waiting for external process to finish its work. E.g. if activity calls an external web method, and then waits for a reply - it returns from Execute method and does not occupy this thread while waiting for the reply, so another activity in the Parallel group can start its job (e.g. also call to a web service) at the same time.