activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alexander N ...@interniche.de>
Subject MessageServlet and Memory-/CPU-Consumption
Date Thu, 21 Jul 2011 14:27:52 GMT
Hi,

I'm running ActiveMQ 5.3.2 as a server under Debian 5.0
and I'm using the REST-Servlet of the demo-webapp 
(MessageServlet) to post messsages to one queue.

The setup is quite out-of-the-box but it shows a strange
behavior when the amount of messages increases 
significantly.
When I'm sending 1 messages/sec, everything works fine.
But with 50 messages/sec the ActiveMQ-Server runs out
of threads or out of memory and in the same time consumes
an essential amount of cpu-time. I configured the JVM with
2Gb of Memory but still after a certain amount of time
(a few hours) out-of-memory-Exceptions occur (for ~50 
messages/sec).

So I've done some research (even bought the book "ActiveMQ in
Action") and came to the conclusion that this behavoir could
occur because of there is probably no pooling of connections 
done if the demo-webapp if is running outside a J2EE-environment.

So I tried to add a pooling connection factory to
activemq.xml (inspired by what is described in the book
on page 166) by adding the following beans to activemq.xml:

        <beans
            ...
              <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
                  <property name="locations">
                     
<value>file:${activemq.base}/conf/credentials.properties</value>
                  </property>
              </bean>
             
        <bean id="jmsConnectionFactory"
class="org.apache.activemq.ActiveMQConnectionFactory">
            <property name="brokerURL" value="tcp://locahost:61616" />
        </bean>
      
        <bean id="pooledJmsConnectionFactory"
class="org.apache.activemq.pool.PooledConnectionFactory"
destroy-method="stop">
            <property name="connectionFactory" ref="jmsConnectionFactory" />
        </bean>
       
        <broker
            ...
        </broker>
        ...
        </beans>

This connection-pool I try to refernce in the web.xml of the
MessageServelet.
It looks like this:

        <web-app>
            ...
        <context-param>
            <param-name>org.apache.activemq.brokerURL</param-name>
            <param-value>tcp://localhost:61616</param-value>
            <description>The URL of the Message Broker to connect
to</description>
        </context-param>
   
        <context-param>
            <param-name>org.apache.activemq.embeddedBroker</param-name>
            <param-value>false</param-value>
            <description>Whether we should include an embedded broker or
not</description>
        </context-param>
       
        <context-param>
            <param-name>org.apache.activemq.connectionFactory</param-name>
            <param-value>pooledJmsConnectionFactory</param-value>
        </context-param>
        ...
        </web-app>

But that doesn't seem to do the pooling-job, at least it has no
effect on memory-consumption. Appearently I'm doing sth wrong
(or even substantally wrong ;) here.


Now I have 2 questions:

1. Can the lack of connection-pooling be the reason of the extensive
memory- and cpu-consumption of the the Message-Servlet on my
(very much default) ActiveMQ-installation ?

2. Is there a way to add connection-pooling to the demo-
webapp without deploying it in a J2EE-container?


Thanx in advance for any help!

--
View this message in context: http://activemq.2283324.n4.nabble.com/MessageServlet-and-Memory-CPU-Consumption-tp3683823p3683823.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message