我们有一个应用程序,每分钟可以消耗大约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" />
记录器方法只记录消息
public void log(final GenericMessage<Object> object) {
LOGGER.info("Logging message" + object);
}
任何建议我应该在哪里看瓶颈。使用spring集成的消息驱动通道适配器,每分钟可以消耗的消息数量是否有任何限制
答案 0 :(得分:1)
注意以下选项:
<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>