ule子疲惫的行动RUN vs WAIT.选择哪个以及何时 [英] Mule Exhausted Action RUN vs WAIT. Which one to choose and when

查看:95
本文介绍了ule子疲惫的行动RUN vs WAIT.选择哪个以及何时的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对Mule线程配置文件Exhausted_Action有疑问.从文档中,我知道当操作为WAIT时,除maxActive之外的任何新请求都将等待线程可用.而RUN的操作将导致使用原始线程来处理请求.根据我的理解,我认为WAIT是更好的方法,而不是RUN.但是,似乎MULE的所有默认值都设置为RUN.只是想听听我对这两个动作的理解和区别以及如何决定何时使用哪个动作的评论.

I have a question on Mule threading profile Exhausted_Action. From the documentation, I understand that when the action is WAIT, any new request beyond the maxActive will wait for a thread to be available. Whereas action of RUN, would cause use the original thread to process the request. From my understanding, I thought WAIT is better way to do it, rather than RUN. However, it appears MULE has all default values set to RUN. Just want to hear for comments on my understanding and differences between these two actions and how to decide which one to use when.

推荐答案

您对WAIT和RUN的理解是正确的.

Your undertanding about WAIT and RUN is correct.

所有默认值均为RUN的原因是,由于流线程不可用,消息处理未停止.由于原始线程(或接收者线程)始终在等待Flow线程接收消息并进行处理,因此为什么不对其进行处理. (这是我的看法.)

Reason why all the default values are RUN is that, The message processing is not stopped because of unavailability of flow thread. Because the original thread(or receiver thread) is anyway waiting for the Flow thread to take the message and process, why not process it. (This is my opinion).

但是使用RUN会有一个缺点.

But there is a downside for using RUN.

例如:

 No of receiver threads are restricted to 2.
 <asynchronous=processing-strategy name="customAsynchronous" maxThreads="1" />
 <flow name="sample" processingStrategy="customAsynchronous" >
    <file:inbound-endpoint ......>
    ............
    ..........
 </flow>

文件大小:1MB,50MB,100MB,1MB,5MB.

File sizes: 1MB, 50MB, 100MB, 1MB, 5MB.

在上述流中,当有5个文件进入时,将处理3个文件,因为有1个流线程可用和2个文件接收器线程(Exhausted_Action = RUN).当第一个文件较小时,流线程将快速完成处理,并继续等待下一条消息.不幸的是,接收者线程的工作是选择下一个文件并将其交给Flow线程进行处理,因此正在忙于处理BIG文件.这样,在流线程正在等待时,接收器线程有可能被耗时的处理所吸引.

In the above flow when there are 5 files coming in. 3 files are processed as there is 1 flow thread available and 2 File Receiver threads (Exhausted_Action = RUN). The flow thread will finish the processing fast as the first file is small and keeps waiting for the next message. Unfortunately the receiver thread whose job is to pick the next file and give it to Flow thread to process is busy processing the BIG file. This way there is a chance of receiver threads getting struck in time consuming processing while the flow threads are waiting.

因此,它始终取决于您要处理的用例.

So it is always depending on the usecase you are dealing with.

希望这会有所帮助.

这篇关于ule子疲惫的行动RUN vs WAIT.选择哪个以及何时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆