Thanks a lot for your continuous replying! In fact I was struggling to improve the performance: Following up your suggestion, vmCursor is presented in queuePolicy without producerFlowControl and no OOM; By my test, the performance down greatly than the test case without the transaction. I attached my source files and configuration files. Could you please to check it and given me some clause?
Thanks again, Zhuran Li At 2011-11-29 17:10:02,SuoNayi <suonayi2...@163.com> wrote: >In addition, you may try the following as well: >3,vmCursor will help to increase the performance of consumers but you'd better >enable producerFlowControl if you do not want to get an OOM. >4,for queue enabling optimizedDispatch will be helpful too. >5,consumer with transaction should be faster than that without transaction. >But if you commit the transaction each time consuming a message it will be >slower indeed. > >At 2011-11-29 10:21:48,lzr <jsw...@163.com> wrote: > >Here comes more performance test information: >Without transaction, I can perform the flow about 500 times per second. >With transaction, it's only 20 times per second. > > > >At 2011-11-29 09:35:30,lzr <jsw...@163.com> wrote: > >Thanks a lot for your timely response! >I'll try it again following up your advice. >I make further test with transaction and found it gets worse and worse:( >Following are my cases: >Client sends request 1 to queue S1, then wait response 1; >Server1 receives request 1 and sends request 2 to queue S2, then wait response >2; >Server2 receives request 2 and sends response 2 back; >Server1 receives response 2 and sends response 1 back; >Client receives response1 and records , the flow is done. > > > >At 2011-11-28 17:19:46,SuoNayi <suonayi2...@163.com> wrote: > >It takes more than one network trips(1.5 network trip in fact) when a >consumer is created and closed. > >Broker will keep the status of all consumers so your use case may cause broker >overheat. >You may try the following: >1,ensuring only one connection is created and reused it always. > Do not create connection every time when you need create session, producer > or consumer etc. >2,Property named alwaysSessionAsync of ConnectionFactory is set to be >false(default true). > >At 2011-11-28 16:17:10,lzr <jsw...@163.com> wrote: > >MessageConsumer creating and closing frequently! > > > >At 2011-11-28 10:51:12,SuoNayi <suonayi2...@163.com> wrote: > > >Only creating consumers no close? >Note that with sparse match of selector, you may get into the trouble of >dispatching message. > > > >-- > >Wangyin >suonayi2...@163.com > > > > > > > > > > > > > > >
amq_test.jar
Description: application/java-archive
<!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <!-- START SNIPPET: example --> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:amq="http://activemq.apache.org/schema/core" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd"> <!-- Allows us to use system properties as variables in this configuration file --> <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> <property name="locations"> <value>file:${activemq.base}/conf/credentials.properties</value> </property> </bean> <!-- The <broker> element is used to configure the ActiveMQ broker. --> <broker xmlns="http://activemq.apache.org/schema/core" brokerName="localhost" dataDirectory="${activemq.base}/data" destroyApplicationContextOnStop="true"> <!-- For better performances use VM cursor and small memory limit. For more information, see: http://activemq.apache.org/message-cursors.html Also, if your producer is "hanging", it's probably due to producer flow control. For more information, see: http://activemq.apache.org/producer-flow-control.html --> <destinationPolicy> <policyMap> <policyEntries> <policyEntry topic=">" producerFlowControl="true" memoryLimit="1mb"> <pendingSubscriberPolicy> <vmCursor /> </pendingSubscriberPolicy> </policyEntry> <policyEntry queue=">" producerFlowControl="false"> <!-- Use VM cursor for better latency For more information, see: http://activemq.apache.org/message-cursors.html --> <pendingQueuePolicy> <vmQueueCursor/> </pendingQueuePolicy> </policyEntry> </policyEntries> </policyMap> </destinationPolicy> <!-- The managementContext is used to configure how ActiveMQ is exposed in JMX. By default, ActiveMQ uses the MBean server that is started by the JVM. For more information, see: http://activemq.apache.org/jmx.html --> <managementContext> <managementContext createConnector="false"/> </managementContext> <!-- Configure message persistence for the broker. The default persistence mechanism is the KahaDB store (identified by the kahaDB tag). For more information, see: http://activemq.apache.org/persistence.html <kahaDB directory="${activemq.base}/data/kahadb"/> --> <persistenceAdapter> <kahaDB directory="${activemq.base}/data/kahadb" enableJournalDiskSyncs="false" indexWriteBatchSize="10000" indexCacheSize="1000"/> </persistenceAdapter> <!-- The systemUsage controls the maximum amount of space the broker will use before slowing down producers. For more information, see: http://activemq.apache.org/producer-flow-control.html --> <systemUsage> <systemUsage> <memoryUsage> <memoryUsage limit="500 mb"/> </memoryUsage> <storeUsage> <storeUsage limit="1 gb"/> </storeUsage> <tempUsage> <tempUsage limit="256 mb"/> </tempUsage> </systemUsage> </systemUsage> <!-- The transport connectors expose ActiveMQ over a given protocol to clients and other brokers. For more information, see: http://activemq.apache.org/configuring-transports.html <transportConnector name="nio" uri="nio://0.0.0.0:61616"/> --> <transportConnectors> <transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/> </transportConnectors> </broker> <!-- Enable web consoles, REST and Ajax APIs and demos It also includes Camel (with its web console), see ${ACTIVEMQ_HOME}/conf/camel.xml for more info Take a look at ${ACTIVEMQ_HOME}/conf/jetty.xml for more details --> <import resource="jetty.xml"/> </beans> <!-- END SNIPPET: example -->