骡子线程池大小上限

时间:2014-11-11 11:33:02

标签: java multithreading mule

我正在尝试将线程池大小设置为大于我测试我的Mule应用程序的机器核心数的数字。

<vm:connector name="persistent" doc:name="VM">
   <receiver-threading-profile
       maxThreadsActive="64"
       poolExhaustedAction="WAIT"
       threadWaitTimeout="-1"/>
   <vm:queue-profile maxOutstandingMessages="5000">
       <default-persistent-queue-store/>
   </vm:queue-profile>
</vm:connector>

最后,我看到Mule将线程数量限制在我的机器核心数量上。即使我尝试在常规配置元素中设置默认池大小,我仍然会遇到相同的限制。

<configuration doc:name="Configuration">
    <default-threading-profile maxThreadsActive="64" maxThreadsIdle="32"/>
</configuration>

这就是发生的事情(我的机器有4个核心)

INFO  2014-11-11 11:12:22,023 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order 21036
INFO  2014-11-11 11:12:22,025 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order 21037
INFO  2014-11-11 11:12:22,030 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order > 6 21038
INFO  2014-11-11 11:12:23,040 [[App-1.0].persistent.receiver.04] org.mule.api.processor.LoggerMessageProcessor: Order 21040
INFO  2014-11-11 11:12:23,040 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order 21039
INFO  2014-11-11 11:12:23,041 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order > 6 21041
INFO  2014-11-11 11:12:23,043 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order 21042
INFO  2014-11-11 11:12:24,060 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order < 3 27
INFO  2014-11-11 11:12:24,061 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order 24
INFO  2014-11-11 11:12:24,062 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order > 6 26
INFO  2014-11-11 11:12:24,063 [[App-1.0].persistent.receiver.04] org.mule.api.processor.LoggerMessageProcessor: Order 23
INFO  2014-11-11 11:12:25,081 [[App-1.0].persistent.receiver.04] org.mule.api.processor.LoggerMessageProcessor: Order > 6 29
INFO  2014-11-11 11:12:25,083 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order < 3 28
INFO  2014-11-11 11:12:25,090 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order > 6 30
INFO  2014-11-11 11:12:25,092 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order 31
INFO  2014-11-11 11:12:26,099 [[App-1.0].persistent.receiver.04] org.mule.api.processor.LoggerMessageProcessor: Order > 6 32
INFO  2014-11-11 11:12:26,103 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order 33
INFO  2014-11-11 11:12:26,103 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order < 3 34
INFO  2014-11-11 11:12:26,105 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order 35
INFO  2014-11-11 11:12:27,118 [[App-1.0].persistent.receiver.03] org.mule.api.processor.LoggerMessageProcessor: Order < 3 41
INFO  2014-11-11 11:12:27,119 [[App-1.0].persistent.receiver.04] org.mule.api.processor.LoggerMessageProcessor: Order > 6 40
INFO  2014-11-11 11:12:27,122 [[App-1.0].persistent.receiver.02] org.mule.api.processor.LoggerMessageProcessor: Order < 3 42
INFO  2014-11-11 11:12:27,125 [[App-1.0].persistent.receiver.01] org.mule.api.processor.LoggerMessageProcessor: Order 43

如何将接收器线程池大小实际增加到64?

1 个答案:

答案 0 :(得分:1)

还有一个名为 numberOfConcurrentTransactedReceivers 的参数,它以某种方式隐藏起来。我在Mule doc网站的任何地方都找不到它,甚至在Dossot的书中也找不到。以下配置为我做了诀窍:

<vm:connector
    name="order.vm.connector"
    createMultipleTransactedReceivers="true"
    numberOfConcurrentTransactedReceivers="64" >

    <receiver-threading-profile
        maxThreadsActive="64"
        poolExhaustedAction="WAIT"
        threadWaitTimeout="-1" />

    <vm:queue-profile maxOutstandingMessages="4096">
        <default-persistent-queue-store />
    </vm:queue-profile>

</vm:connector>

<vm:endpoint
    exchange-pattern="one-way"
    name="order.vm.endpoint"
    path="order.vm"
    connector-ref="order.vm.connector" />