【发布时间】:2014-06-09 05:07:08
【问题描述】:
我正在为我的项目使用 Spring 集成 + WSO2 消息代理。 我的流程是:
Step 1. 客户端调用restful webservice
步骤 2.Restful 从客户端获取信息并发送到请求队列(通过网关)
步骤 3. Activator 从请求队列中获取消息,执行业务逻辑,然后将结果发送回回复队列
Step 4. Restful 为客户端获取结果和响应
我的问题是:为什么 WSO2 太慢了?
我花了 1-2 秒的时间完成了 WSO2 的流程,只有一条消息。但是当我更改为 ActiveMQ 时,性能显着提高(1000 条消息在 6 秒内完成流程)???
我的配置如下:
<!-- WSO2 connection -->
<!-- <jee:jndi-lookup id="connectionFactory" jndi-name="qpidConnectionfactory" cache="true">
<jee:environment>
java.naming.factory.initial=org.wso2.andes.jndi.PropertiesFileInitialContextFactory
connectionfactory.qpidConnectionfactory=amqp://admin:admin@carbon/carbon?brokerlist='tcp://localhost:5672'
</jee:environment>
</jee:jndi-lookup> -->
<!-- ActiveMQ connection -->
<bean name="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory">
<property name="brokerURL">
<value>tcp://localhost:61616</value>
</property>
</bean>
<!-- CB Configuration -->
<int:channel id="cbRequestChanel" ></int:channel>
<int:channel id="cbResponseChanel"></int:channel >
<jms:inbound-gateway
request-channel="cbRequestChanel"
request-destination-name="cbQueueRequest"
connection-factory="connectionFactory" />
<jms:outbound-gateway id="cbOutGateway"
request-destination-name="cbQueueRequest"
reply-destination-name="cbQueueResponse"
request-channel="cbRequestChanel"
reply-channel="cbResponseChanel"
connection-factory="connectionFactory" />
<int:gateway id="cbGateway" default-request-channel="cbRequestChanel"
default-reply-channel="cbResponseChanel"
service-interface="com.test.gateway.ICBGateway" />
<int:service-activator
input-channel="cbRequestChanel" method="receive"
ref="cBServiceActivator">
</int:service-activator>
<bean id="cBServiceActivator" class="com.test.activator.CBServiceActivator" />
【问题讨论】:
-
您使用 WSO2 执行的 JNDI 查找可能需要一些时间。使用 1000 条消息测试 WSO2,就像使用 ActiveMQ 一样,并比较这些执行时间。也许只有第一条消息(您实际执行初始 jndi 查找的地方)需要更多时间。
-
嗨 Andrei Stefan,当然我已经用 WSO2 对 1000 条消息进行了测试,一条消息仍然需要 1-2 秒(非常慢)。如果我等待完成 1000 条消息,我认为它可能超过 1000 秒。
-
有人发现这种糟糕表现的问题/原因是什么?
标签: spring wso2 integration