You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by archa <ar...@persistent.co.in> on 2011/01/05 10:07:58 UTC

How to get the queueLength at runtime

My application is using ActiveMQ 5.4.0, is there any api with which I can
read the queuelength at runtime ?
-- 
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-get-the-queueLength-at-runtime-tp3175017p3175017.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Too many open files

Posted by Don Santillan <do...@gmail.com>.
You mean by default, ActiveMQ is already using KahaDB?

Using the activemq.xml that I posted earlier, the logs show this:
2011-01-06 15:47:48,873  INFO BrokerService:462 - Using Persistence 
Adapter: AMQPersistenceAdapter(/tmp/dev/devbroker)
2011-01-06 15:47:48,882  INFO AMQPersistenceAdapter:177 - AMQStore 
starting using directory: /tmp/dev/devbroker
2011-01-06 15:47:48,988  INFO KahaStore:463 - Kaha Store using data 
directory /tmp/dev/devbroker/kr-store/state
2011-01-06 15:47:49,037  INFO AMQPersistenceAdapter:235 - Active data 
files: []

This means that I'm not using KahaDB, right? Or this is already KahaDB 
that is configured?

I also tried modifying the activemq.xml to use kahaDB instead of 
AMQPersistenceAdapter. Here's the new activemq.xml:
<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">

    <broker xmlns="http://activemq.apache.org/schema/core"
        brokerName="devbroker" persistent="true"
        destroyApplicationContextOnStop="true"
        dataDirectory="/tmp/dev">
       
        <persistenceAdapter>
            <kahaDB
                    directory="/tmp/dev/devbroker/kahaDB-data"
                    journalMaxFileLength="32mb" />
        </persistenceAdapter>
       
        <transportConnectors>
            <transportConnector name="openwire"
                uri="vm://devBroker" />
        </transportConnectors>

        <plugins>
            <statisticsBrokerPlugin />
        </plugins>

    </broker>

</beans>

Running the app with this configuration, the logs show this:
2011-01-06 16:44:22,974  INFO BrokerService:462 - Using Persistence 
Adapter: org.apache.activemq.store.kahadb.KahaDBPersistenceAdapter@36a55


Is this the proper configuration to enable KahaDB?

-don


Juan Nin wrote:
> I'm basically using the default config, with the things I don't use
> disabled, and several values tweaked based on the sample config files
> that come with ActiveMQ
>
>
> On Wed, Jan 5, 2011 at 3:24 PM, Don Santillan <do...@gmail.com> wrote:
>   
>> Thanks for the reply Juan!
>>
>> Can you give me a sample activemq.xml that enables KahaDB with production
>> level settings?
>>
>> -don
>>
>> Can you give me a
>>
>> Juan Nin wrote:
>>     
>>> We used to have this issue with ActiveMQ 5.2.x, so had to rise the
>>> file descriptors.
>>> Since we moved to ActiveMQ 5.3.x and KahaDB, we naver had that issue
>>> again.
>>>
>>> Regards,
>>>
>>> Juan
>>>
>>>
>>> On Wed, Jan 5, 2011 at 12:01 PM, Don Santillan <do...@gmail.com>
>>> wrote:
>>>
>>>       
>>>> Hello,
>>>>
>>>> I have an embedded activemq in my webapp and it is deployed in a jetty
>>>> server. I believe that our server OS's file descriptor limit has enough
>>>> value.
>>>>
>>>> After a few days, the application crashed with the following error:
>>>>
>>>> 2011-01-05 00:34:40.000:WARN::EXCEPTION java.io.IOException: Too many
>>>> open
>>>> files                at sun.nio.ch.ServerSocketChannelImpl.accept0(Native
>>>> Method)
>>>>      at
>>>>
>>>> sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
>>>>      at
>>>>
>>>> org.eclipse.jetty.server.nio.SelectChannelConnector$1.acceptChannel(SelectChannelConnector.java:74)
>>>>          at
>>>>
>>>> org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:650)
>>>>      at
>>>>
>>>> org.eclipse.jetty.io.nio.SelectorManager.doSelect(SelectorManager.java:195)
>>>>      at
>>>>
>>>> org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:134)
>>>>      at
>>>>
>>>> org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:850)
>>>>      at
>>>>
>>>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>>>>      at java.lang.Thread.run(Thread.java:6
>>>>
>>>>
>>>> Is there a possibility that I have configured my activemq or persistence
>>>> wrongly which caused this? Here's my activemq.xml:
>>>> <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">
>>>>
>>>>  <broker xmlns="http://activemq.apache.org/schema/core"
>>>>      brokerName="devbroker" persistent="true"
>>>>      destroyApplicationContextOnStop="true"
>>>>      dataDirectory="/tmp/dev">
>>>>            <transportConnectors>
>>>>          <transportConnector name="openwire"
>>>>              uri="vm://devBroker" />
>>>>      </transportConnectors>
>>>>
>>>>      <plugins>
>>>>          <statisticsBrokerPlugin />
>>>>      </plugins>
>>>>
>>>>  </broker>
>>>>
>>>> </beans>
>>>>
>>>>
>>>> I googled this and saw some posts telling this maybe caused by an
>>>> improper
>>>> setting on memory limit. I also saw some threads that says use kaha db
>>>> for
>>>> better persistence. How am I able to address both of this? Can I
>>>> configure
>>>> both using the activemq.xml alone? What are the appropriate values for an
>>>> application that processes large amount of messages.
>>>>
>>>> Can anyone point me to a good activemq.xml configuration that is good for
>>>> production environment?
>>>>
>>>>
>>>> Thanks!
>>>> -don
>>>>
>>>>
>>>>         
>>>       
>
>   

Re: Too many open files

Posted by Juan Nin <ju...@gmail.com>.
I'm basically using the default config, with the things I don't use
disabled, and several values tweaked based on the sample config files
that come with ActiveMQ


On Wed, Jan 5, 2011 at 3:24 PM, Don Santillan <do...@gmail.com> wrote:
> Thanks for the reply Juan!
>
> Can you give me a sample activemq.xml that enables KahaDB with production
> level settings?
>
> -don
>
> Can you give me a
>
> Juan Nin wrote:
>>
>> We used to have this issue with ActiveMQ 5.2.x, so had to rise the
>> file descriptors.
>> Since we moved to ActiveMQ 5.3.x and KahaDB, we naver had that issue
>> again.
>>
>> Regards,
>>
>> Juan
>>
>>
>> On Wed, Jan 5, 2011 at 12:01 PM, Don Santillan <do...@gmail.com>
>> wrote:
>>
>>>
>>> Hello,
>>>
>>> I have an embedded activemq in my webapp and it is deployed in a jetty
>>> server. I believe that our server OS's file descriptor limit has enough
>>> value.
>>>
>>> After a few days, the application crashed with the following error:
>>>
>>> 2011-01-05 00:34:40.000:WARN::EXCEPTION java.io.IOException: Too many
>>> open
>>> files                at sun.nio.ch.ServerSocketChannelImpl.accept0(Native
>>> Method)
>>>      at
>>>
>>> sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
>>>      at
>>>
>>> org.eclipse.jetty.server.nio.SelectChannelConnector$1.acceptChannel(SelectChannelConnector.java:74)
>>>          at
>>>
>>> org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:650)
>>>      at
>>>
>>> org.eclipse.jetty.io.nio.SelectorManager.doSelect(SelectorManager.java:195)
>>>      at
>>>
>>> org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:134)
>>>      at
>>>
>>> org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:850)
>>>      at
>>>
>>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>>>      at java.lang.Thread.run(Thread.java:6
>>>
>>>
>>> Is there a possibility that I have configured my activemq or persistence
>>> wrongly which caused this? Here's my activemq.xml:
>>> <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">
>>>
>>>  <broker xmlns="http://activemq.apache.org/schema/core"
>>>      brokerName="devbroker" persistent="true"
>>>      destroyApplicationContextOnStop="true"
>>>      dataDirectory="/tmp/dev">
>>>            <transportConnectors>
>>>          <transportConnector name="openwire"
>>>              uri="vm://devBroker" />
>>>      </transportConnectors>
>>>
>>>      <plugins>
>>>          <statisticsBrokerPlugin />
>>>      </plugins>
>>>
>>>  </broker>
>>>
>>> </beans>
>>>
>>>
>>> I googled this and saw some posts telling this maybe caused by an
>>> improper
>>> setting on memory limit. I also saw some threads that says use kaha db
>>> for
>>> better persistence. How am I able to address both of this? Can I
>>> configure
>>> both using the activemq.xml alone? What are the appropriate values for an
>>> application that processes large amount of messages.
>>>
>>> Can anyone point me to a good activemq.xml configuration that is good for
>>> production environment?
>>>
>>>
>>> Thanks!
>>> -don
>>>
>>>
>>
>>
>

Re: Too many open files

Posted by Don Santillan <do...@gmail.com>.
Thanks for the reply Juan!

Can you give me a sample activemq.xml that enables KahaDB with 
production level settings?

-don

Can you give me a

Juan Nin wrote:
> We used to have this issue with ActiveMQ 5.2.x, so had to rise the
> file descriptors.
> Since we moved to ActiveMQ 5.3.x and KahaDB, we naver had that issue again.
>
> Regards,
>
> Juan
>
>
> On Wed, Jan 5, 2011 at 12:01 PM, Don Santillan <do...@gmail.com> wrote:
>   
>> Hello,
>>
>> I have an embedded activemq in my webapp and it is deployed in a jetty
>> server. I believe that our server OS's file descriptor limit has enough
>> value.
>>
>> After a few days, the application crashed with the following error:
>>
>> 2011-01-05 00:34:40.000:WARN::EXCEPTION java.io.IOException: Too many open
>> files                at sun.nio.ch.ServerSocketChannelImpl.accept0(Native
>> Method)
>>       at
>> sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
>>       at
>> org.eclipse.jetty.server.nio.SelectChannelConnector$1.acceptChannel(SelectChannelConnector.java:74)
>>           at
>> org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:650)
>>       at
>> org.eclipse.jetty.io.nio.SelectorManager.doSelect(SelectorManager.java:195)
>>       at
>> org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:134)
>>       at
>> org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:850)
>>       at
>> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>>       at java.lang.Thread.run(Thread.java:6
>>
>>
>> Is there a possibility that I have configured my activemq or persistence
>> wrongly which caused this? Here's my activemq.xml:
>> <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">
>>
>>   <broker xmlns="http://activemq.apache.org/schema/core"
>>       brokerName="devbroker" persistent="true"
>>       destroyApplicationContextOnStop="true"
>>       dataDirectory="/tmp/dev">
>>             <transportConnectors>
>>           <transportConnector name="openwire"
>>               uri="vm://devBroker" />
>>       </transportConnectors>
>>
>>       <plugins>
>>           <statisticsBrokerPlugin />
>>       </plugins>
>>
>>   </broker>
>>
>> </beans>
>>
>>
>> I googled this and saw some posts telling this maybe caused by an improper
>> setting on memory limit. I also saw some threads that says use kaha db for
>> better persistence. How am I able to address both of this? Can I configure
>> both using the activemq.xml alone? What are the appropriate values for an
>> application that processes large amount of messages.
>>
>> Can anyone point me to a good activemq.xml configuration that is good for
>> production environment?
>>
>>
>> Thanks!
>> -don
>>
>>     
>
>   

Re: Too many open files

Posted by Juan Nin <ju...@gmail.com>.
We used to have this issue with ActiveMQ 5.2.x, so had to rise the
file descriptors.
Since we moved to ActiveMQ 5.3.x and KahaDB, we naver had that issue again.

Regards,

Juan


On Wed, Jan 5, 2011 at 12:01 PM, Don Santillan <do...@gmail.com> wrote:
> Hello,
>
> I have an embedded activemq in my webapp and it is deployed in a jetty
> server. I believe that our server OS's file descriptor limit has enough
> value.
>
> After a few days, the application crashed with the following error:
>
> 2011-01-05 00:34:40.000:WARN::EXCEPTION java.io.IOException: Too many open
> files                at sun.nio.ch.ServerSocketChannelImpl.accept0(Native
> Method)
>       at
> sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
>       at
> org.eclipse.jetty.server.nio.SelectChannelConnector$1.acceptChannel(SelectChannelConnector.java:74)
>           at
> org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:650)
>       at
> org.eclipse.jetty.io.nio.SelectorManager.doSelect(SelectorManager.java:195)
>       at
> org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:134)
>       at
> org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:850)
>       at
> org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
>       at java.lang.Thread.run(Thread.java:6
>
>
> Is there a possibility that I have configured my activemq or persistence
> wrongly which caused this? Here's my activemq.xml:
> <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">
>
>   <broker xmlns="http://activemq.apache.org/schema/core"
>       brokerName="devbroker" persistent="true"
>       destroyApplicationContextOnStop="true"
>       dataDirectory="/tmp/dev">
>             <transportConnectors>
>           <transportConnector name="openwire"
>               uri="vm://devBroker" />
>       </transportConnectors>
>
>       <plugins>
>           <statisticsBrokerPlugin />
>       </plugins>
>
>   </broker>
>
> </beans>
>
>
> I googled this and saw some posts telling this maybe caused by an improper
> setting on memory limit. I also saw some threads that says use kaha db for
> better persistence. How am I able to address both of this? Can I configure
> both using the activemq.xml alone? What are the appropriate values for an
> application that processes large amount of messages.
>
> Can anyone point me to a good activemq.xml configuration that is good for
> production environment?
>
>
> Thanks!
> -don
>

Too many open files

Posted by Don Santillan <do...@gmail.com>.
Hello,

I have an embedded activemq in my webapp and it is deployed in a jetty 
server. I believe that our server OS's file descriptor limit has enough 
value.

After a few days, the application crashed with the following error:

2011-01-05 00:34:40.000:WARN::EXCEPTION 
java.io.IOException: Too many open files        
	at sun.nio.ch.ServerSocketChannelImpl.accept0(Native Method)
        at sun.nio.ch.ServerSocketChannelImpl.accept(ServerSocketChannelImpl.java:145)
        at org.eclipse.jetty.server.nio.SelectChannelConnector$1.acceptChannel(SelectChannelConnector.java:74)        
	at org.eclipse.jetty.io.nio.SelectorManager$SelectSet.doSelect(SelectorManager.java:650)
        at org.eclipse.jetty.io.nio.SelectorManager.doSelect(SelectorManager.java:195)
        at org.eclipse.jetty.server.nio.SelectChannelConnector.accept(SelectChannelConnector.java:134)
        at org.eclipse.jetty.server.AbstractConnector$Acceptor.run(AbstractConnector.java:850)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:436)
        at java.lang.Thread.run(Thread.java:6


Is there a possibility that I have configured my activemq or persistence 
wrongly which caused this? Here's my activemq.xml:
<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">

    <broker xmlns="http://activemq.apache.org/schema/core"
        brokerName="devbroker" persistent="true"
        destroyApplicationContextOnStop="true"
        dataDirectory="/tmp/dev">
       
        <transportConnectors>
            <transportConnector name="openwire"
                uri="vm://devBroker" />
        </transportConnectors>

        <plugins>
            <statisticsBrokerPlugin />
        </plugins>

    </broker>

</beans>


I googled this and saw some posts telling this maybe caused by an 
improper setting on memory limit. I also saw some threads that says use 
kaha db for better persistence. How am I able to address both of this? 
Can I configure both using the activemq.xml alone? What are the 
appropriate values for an application that processes large amount of 
messages.

Can anyone point me to a good activemq.xml configuration that is good 
for production environment?


Thanks!
-don

RE: How to get the queueLength at runtime

Posted by Andre vd Merwe <an...@p-cubed.co.za>.
You can also enable the statistics plugin (http://activemq.apache.org/statisticsplugin.html) and then you simply send a message to get the stats.


Andre.

-----Original Message-----
From: chubrilo@gmail.com [mailto:chubrilo@gmail.com] On Behalf Of Dejan Bosanac
Sent: 05 January 2011 11:17
To: users@activemq.apache.org
Subject: Re: How to get the queueLength at runtime

Hi,

you can use JMX API to  get all broker statistics

http://activemq.apache.org/jmx.html

Cheers
--
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dejanb@fusesource.com
Web: http://fusesource.com
Twitter:  http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/ Blog - http://www.nighttale.net



On Wed, Jan 5, 2011 at 10:07 AM, archa <ar...@persistent.co.in> wrote:
>
> My application is using ActiveMQ 5.4.0, is there any api with which I
> can read the queuelength at runtime ?
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-get-the-queueLength-at-ru
> ntime-tp3175017p3175017.html Sent from the ActiveMQ - User mailing
> list archive at Nabble.com.
>


Information contained in this e-mail, including attachments and any rights hereto are the property of Portfolio Prospecting and Performance (Pty) Ltd (unless the context clearly indicates otherwise). It is confidential, private and intended for the addressee only and should you not be the addressee and receive it by mistake, kindly notify the sender and delete this information immediately without further disclosure to any other party. Save for bona fide views of Portfolio Prospecting and Performance (Pty) Ltd, views and opinions expressed in this e-mail are those of the sender only. Portfolio Prospecting and Performance (Pty) Ltd accepts no liability whatsoever for any loss or damages incurred, or suffered, arising from the use the information in this e-mail. Portfolio Prospecting and Performance (Pty) Ltd does not warrant the integrity of this e-mail nor that it is free of errors, viruses, interception or interference


Re: How to get the queueLength at runtime

Posted by Dejan Bosanac <de...@nighttale.net>.
Hi,

you can use JMX API to  get all broker statistics

http://activemq.apache.org/jmx.html

Cheers
--
Dejan Bosanac
-----------------
FuseSource - The experts in open source integration and messaging.
Email: dejanb@fusesource.com
Web: http://fusesource.com
Twitter:  http://twitter.com/dejanb
ActiveMQ in Action - http://www.manning.com/snyder/
Blog - http://www.nighttale.net



On Wed, Jan 5, 2011 at 10:07 AM, archa <ar...@persistent.co.in> wrote:
>
> My application is using ActiveMQ 5.4.0, is there any api with which I can
> read the queuelength at runtime ?
> --
> View this message in context: http://activemq.2283324.n4.nabble.com/How-to-get-the-queueLength-at-runtime-tp3175017p3175017.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>