Spring integration 提高应用程序的JMS消息消耗速度

Spring integration 提高应用程序的JMS消息消耗速度,spring-integration,spring-jms,Spring Integration,Spring Jms,我们有一个每分钟可以消耗大约300条JMS消息的应用程序。我们需要将速度提高到每分钟3000条消息 我创建了一个简单的测试程序,它从队列中读取消息并记录消息。不涉及任何处理,所以我希望速度很快。然而,日志记录仍以每分钟400条消息的速度进行 下面是我节目的节选 <int-jms:message-driven-channel-adapter id="testJmsInboundAdapter" auto-startup="true" destination="testQue

我们有一个每分钟可以消耗大约300条JMS消息的应用程序。我们需要将速度提高到每分钟3000条消息

我创建了一个简单的测试程序,它从队列中读取消息并记录消息。不涉及任何处理,所以我希望速度很快。然而,日志记录仍以每分钟400条消息的速度进行

下面是我节目的节选

<int-jms:message-driven-channel-adapter id="testJmsInboundAdapter" 
    auto-startup="true"
    destination="testQueueDestination" 
    connection-factory="testConnectionFactory" 
    channel="messageTransformerChannel" />

<int:channel id="messageTransformerChannel" />

<int:service-activator 
    id="loggerActivator"
    input-channel="messageTransformerChannel" 
    method="log"
    ref="logger" />

logger方法只是记录消息

public void log(final GenericMessage<Object> object) {
        LOGGER.info("Logging message" + object);
    }
公共作废日志(最终GenericMessage对象){
LOGGER.info(“记录消息”+对象);
}

有什么建议我应该在哪里看瓶颈。使用spring integration的消息驱动通道适配器每分钟可以使用的消息数量是否有任何限制请注意以下选项:

<xsd:attribute name="concurrent-consumers" type="xsd:string">
        <xsd:annotation>
            <xsd:documentation>
                Specify the number of concurrent consumers to create. Default is 1.
                    Specifying a higher value for this setting will increase the standard
                    level of scheduled concurrent consumers at runtime: This is effectively
                    the minimum number of concurrent consumers which will be scheduled
                    at any given time. This is a static setting; for dynamic scaling,
                    consider specifying the "maxConcurrentConsumers" setting instead.
                    Raising the number of concurrent consumers is recommendable in order
                    to scale the consumption of messages coming in from a queue. However,
                    note that any ordering guarantees are lost once multiple consumers are
                    registered
            </xsd:documentation>
        </xsd:annotation>
    </xsd:attribute>
    <xsd:attribute name="max-concurrent-consumers" type="xsd:string">
        <xsd:annotation>
            <xsd:documentation>
                 Specify the maximum number of concurrent consumers to create. Default is 1.
                     If this setting is higher than "concurrentConsumers", the listener container
                     will dynamically schedule new consumers at runtime, provided that enough
                     incoming messages are encountered. Once the load goes down again, the number of
                     consumers will be reduced to the standard level ("concurrentConsumers") again.
                     Raising the number of concurrent consumers is recommendable in order
                    to scale the consumption of messages coming in from a queue. However,
                    note that any ordering guarantees are lost once multiple consumers are
                    registered.
            </xsd:documentation>
        </xsd:annotation>
    </xsd:attribute>

指定要创建的并发使用者的数量。默认值为1。
为此设置指定更高的值将提高标准
运行时计划的并发使用者的级别:这是有效的
将计划的并发使用者的最小数目
在任何给定的时间。这是一个静态设置;对于动态缩放,
考虑指定“Max CurrurtCuffs”设置。
建议按顺序增加并发使用者的数量
扩展从队列传入的消息的使用量。然而,
请注意,一旦有多个消费者参与,任何订购保证都将丢失
登记
指定要创建的并发使用者的最大数目。默认值为1。
如果此设置高于“concurrentConsumers”,则侦听器容器
将在运行时动态调度新的使用者,前提是
遇到传入消息。一旦负载再次下降,则
消费者将再次降至标准水平(“concurrentConsumers”)。
建议按顺序增加并发使用者的数量
扩展从队列传入的消息的使用量。然而,
请注意,一旦有多个消费者参与,任何订购保证都将丢失
注册的。

谢谢,使用concurrent consumer=“5”将处理速度提高到每分钟2k条消息。您能否解释一下concurrent consumer属性是如何工作的。如果我将concurrent consumer value设置为5,它是否会创建5个线程,同时开始从JMS队列读取数据。此外,如果最终使用上述示例中检索到的消息的记录器bean属于范围原型,那么将为每个线程创建不同的记录器bean,还是所有线程都引用相同的记录器bean,它们将同时这样做。记录器bean将仅为Service Activator端点创建一次,并且仅在应用程序启动应用程序期间创建。请阅读
DefaultMessageListenerContainer.setConcurrency(String concurrency)
JavaDocs上的内容。