You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by christyc <ca...@avaya.com> on 2006/07/13 22:36:48 UTC

Getting OutOfMemoryError: Java heap space

Maybe this is obvious, but I've been scouring the forum and website and am
thinking that we have a configuration problem (hopefully) and not a bug. 
Anyway, we have multiple users as publishers and am trying to test the
persistentence capability by not having any consumers consume messages.  We
have some requirements that 1 million messages must be persisted and in our
current test, we generate up to 400k messages and then get OutOfMemoryError
: Java heap space coming from ActiveMQ.  From what I see on the website,
having topics that are durable should be persisted to the database and
spooled to disk.  We pretty much are using the out of a box activemq.xml
configuration, but I don't see derby directories or the journal directories
getting touched.  It seems like we don't have the derby database configured
correctly.  We are using durable topics with asynch sending and memory
management is set to 0 (which I thought I  picked up as being unlimited). 
How can you verify that the data is being spooled to disk and derby?  Here's
our activemq.xml:

 <beans xmlns="http://activemq.org/config/1.0">

    <bean
class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>

    <broker persistent="true" useJmx="true">

    <!--  Use the following to set the broker memory limit (in bytes) -->
    <memoryManager>
        <usageManager id="memory-manager" limit="0"/>
    </memoryManager>

    <!-- In ActiveMQ 4, you can setup destination policies -->
    <destinationPolicy>
      <policyMap><policyEntries>
           <policyEntry topic="FOO.>">
            <dispatchPolicy>
              <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
              <lastImageSubscriptionRecoveryPolicy />
            </subscriptionRecoveryPolicy>
          </policyEntry>

          <policyEntry topic="com.avaya.coreservice.management.TESTTOPIC">
            <dispatchPolicy>
               <strictOrderDispatchPolicy />
            </dispatchPolicy>
            <subscriptionRecoveryPolicy>
               <!--<timedSubscriptionRecoveryPolicy
recoverDuration="60000"/>-->
                <fixedCountSubscriptionRecoveryPolicy
maximumSize="1000000"/>

            </subscriptionRecoveryPolicy>

            <pendingMessageLimitStrategy>
               <constantPendingMessageLimitStrategy limit="1000000"/>
                                                                                                   
</pendingMessageLimitStrategy>
          </policyEntry>

      </policyEntries></policyMap>
    </destinationPolicy>

    <persistenceAdapter>
          <journaledJDBC journalLogFiles="5"
dataDirectory="${activemq.home}/activemq-data" />
                                                                                           
    </persistenceAdapter>

    <transportConnectors>
       <transportConnector name="default" uri="tcp://localhost:61616"
discoveryUri="multicast://default"/>
       <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
    </transportConnectors>

    <networkConnectors>
      <!-- by default just auto discover the other brokers -->
      <networkConnector name="default" uri="multicast://default"/>
        </networkConnectors>

  </broker>
</beans>

-- 
View this message in context: http://www.nabble.com/Getting-OutOfMemoryError%3A-Java-heap-space-tf1939814.html#a5316267
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Getting OutOfMemoryError: Java heap space

Posted by Tito Flagella <ti...@link.it>.
christyc wrote:

>Anyway, we have multiple users as publishers and am trying to test the
>persistentence capability by not having any consumers consume messages.  We
>have some requirements that 1 million messages must be persisted and in our
>current test, we generate up to 400k messages and then get OutOfMemoryError
>: Java heap space coming from ActiveMQ.  From what I see on the website,
>having topics that are durable should be persisted to the database and
>spooled to disk.
>
We are doing a very similar test and getting better results, using both 
the journal and postgres db as persistent backend (find the broker 
configuration enclosed).

We have now a serious problem in the broker not recovering from postgres 
failures. When that happens, amq let quickly grow one of the the journal 
files from about 20 MB to 60 and then blocks forever. Neither restarting 
postgres nor restarting the broker allow amq to recover.

To replicate the problem:

- Linux, java 1.5
- ActiveMQ 4.0.1
- activemq.xml, as enclosed
- postgres 7.4.13

Then run the enclosed producer. After running for some minutes, stop 
postgres and amq will not be able to recover, neither restarting 
postgres nor restarting amq.

tito.


Re: Getting OutOfMemoryError: Java heap space

Posted by christyc <ca...@avaya.com>.
I verified that yes, we have persistent messages being published
We are using AMQ 4.0.1
JVM heap space is 520,256 kbytes
yes, our consumers are only durable
-- 
View this message in context: http://www.nabble.com/Getting-OutOfMemoryError%3A-Java-heap-space-tf1939814.html#a5331195
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Getting OutOfMemoryError: Java heap space

Posted by James Strachan <ja...@gmail.com>.
A few questions...

* what version of ActiveMQ are you using?
* whats the heap for the JVM running the broker?
* are you enabling persistent delivery on your producer?
* are the only consumers durable consumers?

Am guessing you don't have any durable consumers which is why no
messages are persisted?

BTW the setting:             <constantPendingMessageLimitStrategy
limit="1000000"/>

is not worth using as that means keep around 1000000 messages per slow
consumer before discarding any; you'll probably run out of heap before
it ever got chance to evict any messages.


On 7/13/06, christyc <ca...@avaya.com> wrote:
>
> Maybe this is obvious, but I've been scouring the forum and website and am
> thinking that we have a configuration problem (hopefully) and not a bug.
> Anyway, we have multiple users as publishers and am trying to test the
> persistentence capability by not having any consumers consume messages.  We
> have some requirements that 1 million messages must be persisted and in our
> current test, we generate up to 400k messages and then get OutOfMemoryError
> : Java heap space coming from ActiveMQ.  From what I see on the website,
> having topics that are durable should be persisted to the database and
> spooled to disk.  We pretty much are using the out of a box activemq.xml
> configuration, but I don't see derby directories or the journal directories
> getting touched.  It seems like we don't have the derby database configured
> correctly.  We are using durable topics with asynch sending and memory
> management is set to 0 (which I thought I  picked up as being unlimited).
> How can you verify that the data is being spooled to disk and derby?  Here's
> our activemq.xml:
>
>  <beans xmlns="http://activemq.org/config/1.0">
>
>     <bean
> class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"/>
>
>     <broker persistent="true" useJmx="true">
>
>     <!--  Use the following to set the broker memory limit (in bytes) -->
>     <memoryManager>
>         <usageManager id="memory-manager" limit="0"/>
>     </memoryManager>
>
>     <!-- In ActiveMQ 4, you can setup destination policies -->
>     <destinationPolicy>
>       <policyMap><policyEntries>
>            <policyEntry topic="FOO.>">
>             <dispatchPolicy>
>               <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>               <lastImageSubscriptionRecoveryPolicy />
>             </subscriptionRecoveryPolicy>
>           </policyEntry>
>
>           <policyEntry topic="com.avaya.coreservice.management.TESTTOPIC">
>             <dispatchPolicy>
>                <strictOrderDispatchPolicy />
>             </dispatchPolicy>
>             <subscriptionRecoveryPolicy>
>                <!--<timedSubscriptionRecoveryPolicy
> recoverDuration="60000"/>-->
>                 <fixedCountSubscriptionRecoveryPolicy
> maximumSize="1000000"/>
>
>             </subscriptionRecoveryPolicy>
>
>             <pendingMessageLimitStrategy>
>                <constantPendingMessageLimitStrategy limit="1000000"/>
>
> </pendingMessageLimitStrategy>
>           </policyEntry>
>
>       </policyEntries></policyMap>
>     </destinationPolicy>
>
>     <persistenceAdapter>
>           <journaledJDBC journalLogFiles="5"
> dataDirectory="${activemq.home}/activemq-data" />
>
>     </persistenceAdapter>
>
>     <transportConnectors>
>        <transportConnector name="default" uri="tcp://localhost:61616"
> discoveryUri="multicast://default"/>
>        <transportConnector name="stomp"   uri="stomp://localhost:61613"/>
>     </transportConnectors>
>
>     <networkConnectors>
>       <!-- by default just auto discover the other brokers -->
>       <networkConnector name="default" uri="multicast://default"/>
>         </networkConnectors>
>
>   </broker>
> </beans>
>
> --
> View this message in context: http://www.nabble.com/Getting-OutOfMemoryError%3A-Java-heap-space-tf1939814.html#a5316267
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


-- 

James
-------
http://radio.weblogs.com/0112098/