Results 1 to 10 of 17

Thread: Jmstemplate is a bottle neck in performance

Hybrid View

  1. #1
    Join Date
    Jul 2012
    Posts
    27

    Default Jmstemplate is a bottle neck in performance

    Hi, i am comparing the performance of active mq using spring and with out spring.
    it seems that with spring is much slower.
    It looks like the problem is with sending and not receiving. When i use jmstemplate it is much slower.
    any ideas why?
    how can i improve performance of jms template?

    please note that i tested these 2 configurations:

    Code:
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
             <property name="connectionFactory" ref="pooledConnectionFactory"/>  
         </bean>
    <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
             <property name="connectionFactory" ref="cachingConnectionFactory"/>  
         </bean>
    thanks
    Last edited by michals; Dec 5th, 2012 at 05:15 AM.

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Post your tests... My guess is that you are comparing apples and oranges...

    Also when posting code use [ code][/code ] tags that way it remains readable.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Jul 2012
    Posts
    27

    Default

    I can't post my entire test, i don't see where i can attach files.

    I am testing this flow:
    1.Client->send request ->Server.
    2. Server->send response->Client.
    3. Client->receive response&send message to some measurement client
    4. Measurement Client->receive message - after receiving all messages it will stop the timer.

    This full flow is tested for 300k messages.
    and it takes for Activemq with no spring half the time as it does for with spring.

    Here is the spring xml i am using.
    Code:
    <!-- ********************** Consumer ********************************* --> 
    	<bean id="clientListener" class="example.ClientReceive">
    		<property name="receiveQueue" ref="receiveQueue" />
    		<property name="sinkQueue" ref="sinkQueue" />
    		<property name="clientSender" ref="clientSender"/> 
    	</bean>
    
    	<bean id="containerClient"
    		class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    		<property name="concurrentConsumers" value="20"/><!-- if it is not 1 - it is difficult to see distribution to other services!!!change to 50,20 -->
                <property name="maxConcurrentConsumers" value="50"/><!-- if it is not 1 - it is difficult to see distribution to other services!!!change to 50-->
                <property name="idleTaskExecutionLimit" value="10"/>
                <!-- <property name="maxMessagesPerTask" value="30"/> -->
    		<property name="connectionFactory" ref="singleConnectionFactory" />
    		<property name="destination" ref="receiveQueue" />
    		<property name="messageListener" ref="clientListener" />
    		<property name="sessionAcknowledgeMode" value="1"/>
    	</bean>
    	
    	
    	
    	<bean id="receiveQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="queueA"/>
        </bean>
        <bean id="sinkQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="sinkQueue"/>
        </bean>
        
        <!-- **********************  END-Consumer *****************************	-->
        
    	
    	<!-- ********************** Producer ********************************* --> 
    	<bean id="clientSender" class="example.ClientSend">
    		 <property name="sendQueue" ref="sendQueue" /> 
    		 <property name="jmsTemplate" ref="jmsTemplate"/>  
    	</bean>
    	
    	 <bean id="sendQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="queueB"/>
        </bean> 
        
         <!-- for send response on temp q-->
        <bean id="jmsTemplate" class="org.springframework.jms.core.JmsTemplate" lazy-init="true">
             <property name="connectionFactory" ref="cachingConnectionFactory"/>  
         </bean>
    	
    	<!-- ********************** END Producer ********************************* -->
     
        
        
        <!-- ********************** Common ********************************* -->
        
    	<bean id="connectionFactory" 
    		class="org.apache.activemq.ActiveMQConnectionFactory">
    		 <property name="brokerURL" value="failover:(tcp://localhost:61616)?randomize=false" />    <!-- Single broker-->
    		 <!-- <property name="brokerURL" value="tcp://localhost:61616" /> --> 
    		  <!-- <property name="brokerURL" value="failover:(tcp://localhost:61616?wireFormat.tightEncodingEnabled=false)?randomize=false" /> --><!-- for vertical scalability-->
    		 <!-- <property name="brokerURL" value="failover:(tcp://localhost:61616,tcp://dev15:61616)?randomize=true"/> --> <!-- network of brokers -->
    		<!-- <property name="brokerURL" value="failover:(tcp://dev15:61616)?randomize=true"/> -->
    		<!-- <property name="brokerURL" value="vm://amq3?brokerConfig=xbean:amq3.xml" /> --><!-- embedded broker for network of brokers -->
    		<!-- <property name="brokerURL" value="failover:(tcp://0.0.0.0:61618,tcp://0.0.0.0:61617)" />  --><!-- service broker for network of brokers : connect to amq3-->
    		<!-- <property name="brokerURL" value="failover:(tcp://0.0.0.0:61618)" /> --> <!-- connection amq3 -->
    	</bean>
    	
        <bean id="singleConnectionFactory" class="org.springframework.jms.connection.SingleConnectionFactory">
        	 <property name="targetConnectionFactory"
        		ref="connectionFactory" />
        		<property name="reconnectOnException" value="true"/>
        </bean>
        
         <bean id="pooledConnectionFactory"  
    		class="org.apache.activemq.pool.PooledConnectionFactory">
    		<constructor-arg ref="connectionFactory"/>
    		<property name="maxConnections" value="10" /> 
    	</bean>    
    	
    	  <bean id="cachingConnectionFactory"  
    		class="org.springframework.jms.connection.CachingConnectionFactory">
    		<constructor-arg ref="singleConnectionFactory"/>
    		<property name="sessionCacheSize" value="100" /> 
    	</bean>   
    	
        <!-- <bean id="sinkQueue" class="org.apache.activemq.command.ActiveMQQueue">
            <constructor-arg value="sinkQueue"/>
        </bean> -->
    	
         
    </beans>
    I am not sure what you mean by "comparing apples and oranges"... i am testing the same code, once with spring and once with
    creating my own activemq objects and using

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    I am not sure what you mean by "comparing apples and oranges"... i am testing the same code, once with spring and once with
    creating my own activemq objects and using
    Which is exactly what I mean by comparing apples and oranges...

    Hence my request for the code you wrote/use (inlcuding the configuration)...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Jul 2012
    Posts
    27

    Default

    Is there a way to attach files other than images?

  6. #6
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    By simply attaching them (you might need to go to advanced mode for that)... If the code isn't that large you could copy/paste in the post using [ code][/code ] tags to maintain formatting.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •