You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@servicemix.apache.org by ivan <iv...@dhousestudio.com> on 2008/08/28 15:52:50 UTC

OutOfMemory in ActiveMQ

   Hi!

I'm new in using AMQ and I use ServiceMix 3.2.1 and configure some
JMS-services for listenning to external ActiveMQ 5.1.0 (total: 2 queues).

After starting SMX amd AMQ 5.1.0, AMQ uses approx. 70 + 164 Mb (RAM + 
Virtual).
But sometimes I see AMQ uses more than -Xmx value (I set -Xmx768Mb in
activemq.bat, but it didn't help; 800Mb of Virtual Memory was used) and
in console I saw following:

Loading message broker from: xbean:activemq.xml
INFO  BrokerService                  - Using Persistence Adapter:
AMQPersistenceAdapter(F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data)
INFO  BrokerService                  - ActiveMQ 5.1.0 JMS Message Broker
(localhost) is starting
INFO  BrokerService                  - For help or more information
please see: http://activemq.apac
he.org/
INFO  AMQPersistenceAdapter          - AMQStore starting using
directory: F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data
INFO  KahaStore                      - Kaha Store using data directory
F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\state
INFO  AMQPersistenceAdapter          - Active data files: []
INFO  KahaStore                      - Kaha Store using data directory
F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\data
INFO  TransportServerThreadSupport   - Listening for connections at:
tcp://myhost:61616
INFO  TransportConnector             - Connector openwire Started
INFO  BrokerService                  - ActiveMQ JMS Message Broker
(localhost, ID:jsws-2-1069-121991
7283218-0:0) started
INFO  log                            - Logging to
org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) v
ia org.mortbay.log.Slf4jLog
INFO  log                            - jetty-6.1.9
INFO  WebConsoleStarter              - ActiveMQ WebConsole initialized.
INFO  /admin                         - Initializing Spring
FrameworkServlet 'dispatcher'
INFO  log                            - ActiveMQ Console at
http://0.0.0.0:8161/admin
INFO  log                            - ActiveMQ Web Demos at
http://0.0.0.0:8161/demo
INFO  log                            - RESTful file access application
at http://0.0.0.0:8161/filese
rver
INFO  log                            - Started
SelectChannelConnector@0.0.0.0:8161
Exception in thread "ActiveMQ Transport: tcp:///127.0.0.1:1077"
java.lang.OutOfMemoryError: Java hea
p space



It could appear after few minutes of working AMQ and SMX (10-15
minutes). I don't send any JMS message, just SMX and AMQ are running.




I use:

in jms-consumer-service (xbean.xml):

  <jms:consumer service="prefix:SomeService"
               endpoint="endpoint"
               targetService="prefix:SomeService"
               targetInterface="prefix:SomeService"
               destinationName="some.queue"
               connectionFactory="#connectionFactory"
               concurrentConsumers="8"
               marshaler="#marshaler" />

  <amq:connectionFactory id="connectionFactory" 
brokerURL="tcp://localhost:61616" />

  <bean id="marshaler" class="mypackage.CustomConsumerMarshaler">   		
	</bean>


I also use my own marshaller (for accepting ActiveMQBytesMessage type of 
messages):


protected void populateMessage(Message message,
			NormalizedMessage normalizedMessage) throws Exception {

		if (message instanceof TextMessage) {
			TextMessage textMessage = (TextMessage) message;
			Source source = new StringSource(textMessage.getText());
			normalizedMessage.setContent(source);

		} else if (message instanceof ActiveMQBytesMessage) {
			ActiveMQBytesMessage byteMessage = (ActiveMQBytesMessage) message;


			Enumeration enum1 = message.getPropertyNames();
			Object element = null;
			for (; enum1.hasMoreElements();) {
				element = enum1.nextElement();
				String value = message.getStringProperty((String) element);
				normalizedMessage.setProperty((String) element, value);
			}

		} else {
			throw new UnsupportedOperationException(
					"JMS message is not a TextMessage or ActiveMQBytesMessage");
		}
	}


SMX's embedded AMQ 4.1.1 is configured to other port (51515).


What can be cause of OutOfMemory?
What specific configuration of AMQ/SMX-JMS-consumer-service should I use 
to avoid those problems with OutOfMemory?


   Thanks,
   Truly yours,
   Ivan Pryvalov.


Re: OutOfMemory in ActiveMQ

Posted by ivan <iv...@dhousestudio.com>.
Gert Vanthienen пишет:
> Ivan,
> 
> Could you take a JMX console and connect to ServiceMix and ActiveMQ to 
> check if there the increase in thread usage?

I found the cause of OutOfMemory:

It's because I had 8 concurrentConsumers (I just used example from 
web-page "New endpoints ...") into 2 JMS serices (total: 16 concurrent 
consumers).
When I set to 1 - it seems OK, I didn't see anymore OutOfMemory.


Thanks,
Ivan Pryvalov.

> 
> Regards,
> 
> Gert
> 
> ivan wrote:
>>   Hi!
>>
>> I'm new in using AMQ and I use ServiceMix 3.2.1 and configure some
>> JMS-services for listenning to external ActiveMQ 5.1.0 (total: 2 queues).
>>
>> After starting SMX amd AMQ 5.1.0, AMQ uses approx. 70 + 164 Mb (RAM + 
>> Virtual).
>> But sometimes I see AMQ uses more than -Xmx value (I set -Xmx768Mb in
>> activemq.bat, but it didn't help; 800Mb of Virtual Memory was used) and
>> in console I saw following:
>>
>> Loading message broker from: xbean:activemq.xml
>> INFO  BrokerService                  - Using Persistence Adapter:
>> AMQPersistenceAdapter(F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data)
>> INFO  BrokerService                  - ActiveMQ 5.1.0 JMS Message Broker
>> (localhost) is starting
>> INFO  BrokerService                  - For help or more information
>> please see: http://activemq.apac
>> he.org/
>> INFO  AMQPersistenceAdapter          - AMQStore starting using
>> directory: F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data
>> INFO  KahaStore                      - Kaha Store using data directory
>> F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\state
>> INFO  AMQPersistenceAdapter          - Active data files: []
>> INFO  KahaStore                      - Kaha Store using data directory
>> F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\data
>> INFO  TransportServerThreadSupport   - Listening for connections at:
>> tcp://myhost:61616
>> INFO  TransportConnector             - Connector openwire Started
>> INFO  BrokerService                  - ActiveMQ JMS Message Broker
>> (localhost, ID:jsws-2-1069-121991
>> 7283218-0:0) started
>> INFO  log                            - Logging to
>> org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) v
>> ia org.mortbay.log.Slf4jLog
>> INFO  log                            - jetty-6.1.9
>> INFO  WebConsoleStarter              - ActiveMQ WebConsole initialized.
>> INFO  /admin                         - Initializing Spring
>> FrameworkServlet 'dispatcher'
>> INFO  log                            - ActiveMQ Console at
>> http://0.0.0.0:8161/admin
>> INFO  log                            - ActiveMQ Web Demos at
>> http://0.0.0.0:8161/demo
>> INFO  log                            - RESTful file access application
>> at http://0.0.0.0:8161/filese
>> rver
>> INFO  log                            - Started
>> SelectChannelConnector@0.0.0.0:8161
>> Exception in thread "ActiveMQ Transport: tcp:///127.0.0.1:1077"
>> java.lang.OutOfMemoryError: Java hea
>> p space
>>
>>
>>
>> It could appear after few minutes of working AMQ and SMX (10-15
>> minutes). I don't send any JMS message, just SMX and AMQ are running.
>>
>>
>>
>>
>> I use:
>>
>> in jms-consumer-service (xbean.xml):
>>
>>  <jms:consumer service="prefix:SomeService"
>>               endpoint="endpoint"
>>               targetService="prefix:SomeService"
>>               targetInterface="prefix:SomeService"
>>               destinationName="some.queue"
>>               connectionFactory="#connectionFactory"
>>               concurrentConsumers="8"
>>               marshaler="#marshaler" />
>>
>>  <amq:connectionFactory id="connectionFactory" 
>> brokerURL="tcp://localhost:61616" />
>>
>>  <bean id="marshaler" 
>> class="mypackage.CustomConsumerMarshaler">              </bean>
>>
>>
>> I also use my own marshaller (for accepting ActiveMQBytesMessage type 
>> of messages):
>>
>>
>> protected void populateMessage(Message message,
>>             NormalizedMessage normalizedMessage) throws Exception {
>>
>>         if (message instanceof TextMessage) {
>>             TextMessage textMessage = (TextMessage) message;
>>             Source source = new StringSource(textMessage.getText());
>>             normalizedMessage.setContent(source);
>>
>>         } else if (message instanceof ActiveMQBytesMessage) {
>>             ActiveMQBytesMessage byteMessage = (ActiveMQBytesMessage) 
>> message;
>>
>>
>>             Enumeration enum1 = message.getPropertyNames();
>>             Object element = null;
>>             for (; enum1.hasMoreElements();) {
>>                 element = enum1.nextElement();
>>                 String value = message.getStringProperty((String) 
>> element);
>>                 normalizedMessage.setProperty((String) element, value);
>>             }
>>
>>         } else {
>>             throw new UnsupportedOperationException(
>>                     "JMS message is not a TextMessage or 
>> ActiveMQBytesMessage");
>>         }
>>     }
>>
>>
>> SMX's embedded AMQ 4.1.1 is configured to other port (51515).
>>
>>
>> What can be cause of OutOfMemory?
>> What specific configuration of AMQ/SMX-JMS-consumer-service should I 
>> use to avoid those problems with OutOfMemory?
>>
>>
>>   Thanks,
>>   Truly yours,
>>   Ivan Pryvalov.
>>
>>
> 
> 


Re: OutOfMemory in ActiveMQ

Posted by Gert Vanthienen <ge...@skynet.be>.
Ivan,

Could you take a JMX console and connect to ServiceMix and ActiveMQ to 
check if there the increase in thread usage?

Regards,

Gert

ivan wrote:
>   Hi!
>
> I'm new in using AMQ and I use ServiceMix 3.2.1 and configure some
> JMS-services for listenning to external ActiveMQ 5.1.0 (total: 2 queues).
>
> After starting SMX amd AMQ 5.1.0, AMQ uses approx. 70 + 164 Mb (RAM + 
> Virtual).
> But sometimes I see AMQ uses more than -Xmx value (I set -Xmx768Mb in
> activemq.bat, but it didn't help; 800Mb of Virtual Memory was used) and
> in console I saw following:
>
> Loading message broker from: xbean:activemq.xml
> INFO  BrokerService                  - Using Persistence Adapter:
> AMQPersistenceAdapter(F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data)
> INFO  BrokerService                  - ActiveMQ 5.1.0 JMS Message Broker
> (localhost) is starting
> INFO  BrokerService                  - For help or more information
> please see: http://activemq.apac
> he.org/
> INFO  AMQPersistenceAdapter          - AMQStore starting using
> directory: F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data
> INFO  KahaStore                      - Kaha Store using data directory
> F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\state
> INFO  AMQPersistenceAdapter          - Active data files: []
> INFO  KahaStore                      - Kaha Store using data directory
> F:\path_to_AMQ\apache-activemq-5.1.0\bin\..\data\kr-store\data
> INFO  TransportServerThreadSupport   - Listening for connections at:
> tcp://myhost:61616
> INFO  TransportConnector             - Connector openwire Started
> INFO  BrokerService                  - ActiveMQ JMS Message Broker
> (localhost, ID:jsws-2-1069-121991
> 7283218-0:0) started
> INFO  log                            - Logging to
> org.slf4j.impl.JCLLoggerAdapter(org.mortbay.log) v
> ia org.mortbay.log.Slf4jLog
> INFO  log                            - jetty-6.1.9
> INFO  WebConsoleStarter              - ActiveMQ WebConsole initialized.
> INFO  /admin                         - Initializing Spring
> FrameworkServlet 'dispatcher'
> INFO  log                            - ActiveMQ Console at
> http://0.0.0.0:8161/admin
> INFO  log                            - ActiveMQ Web Demos at
> http://0.0.0.0:8161/demo
> INFO  log                            - RESTful file access application
> at http://0.0.0.0:8161/filese
> rver
> INFO  log                            - Started
> SelectChannelConnector@0.0.0.0:8161
> Exception in thread "ActiveMQ Transport: tcp:///127.0.0.1:1077"
> java.lang.OutOfMemoryError: Java hea
> p space
>
>
>
> It could appear after few minutes of working AMQ and SMX (10-15
> minutes). I don't send any JMS message, just SMX and AMQ are running.
>
>
>
>
> I use:
>
> in jms-consumer-service (xbean.xml):
>
>  <jms:consumer service="prefix:SomeService"
>               endpoint="endpoint"
>               targetService="prefix:SomeService"
>               targetInterface="prefix:SomeService"
>               destinationName="some.queue"
>               connectionFactory="#connectionFactory"
>               concurrentConsumers="8"
>               marshaler="#marshaler" />
>
>  <amq:connectionFactory id="connectionFactory" 
> brokerURL="tcp://localhost:61616" />
>
>  <bean id="marshaler" 
> class="mypackage.CustomConsumerMarshaler">          
>     </bean>
>
>
> I also use my own marshaller (for accepting ActiveMQBytesMessage type 
> of messages):
>
>
> protected void populateMessage(Message message,
>             NormalizedMessage normalizedMessage) throws Exception {
>
>         if (message instanceof TextMessage) {
>             TextMessage textMessage = (TextMessage) message;
>             Source source = new StringSource(textMessage.getText());
>             normalizedMessage.setContent(source);
>
>         } else if (message instanceof ActiveMQBytesMessage) {
>             ActiveMQBytesMessage byteMessage = (ActiveMQBytesMessage) 
> message;
>
>
>             Enumeration enum1 = message.getPropertyNames();
>             Object element = null;
>             for (; enum1.hasMoreElements();) {
>                 element = enum1.nextElement();
>                 String value = message.getStringProperty((String) 
> element);
>                 normalizedMessage.setProperty((String) element, value);
>             }
>
>         } else {
>             throw new UnsupportedOperationException(
>                     "JMS message is not a TextMessage or 
> ActiveMQBytesMessage");
>         }
>     }
>
>
> SMX's embedded AMQ 4.1.1 is configured to other port (51515).
>
>
> What can be cause of OutOfMemory?
> What specific configuration of AMQ/SMX-JMS-consumer-service should I 
> use to avoid those problems with OutOfMemory?
>
>
>   Thanks,
>   Truly yours,
>   Ivan Pryvalov.
>
>