You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Jean Silga <je...@net-vitesse.com> on 2013/06/05 17:19:03 UTC

How can I limit the amount of messages kept in LRUCache?

Hi guys

We are currently using activemq for one of our project and we run into some
out of memory trouble lately. Our application performs some caching every
two hours: It reads the information to cache, encapsulates it in an
ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object to a
topic so that the consumer can receive it and perform the caching. The
problem is that  the LRUCache is keeping up to 100 messages in its cache
(maxCacheSize=100), and this is causing an out of memory error because each
message is quite big (10 MB of size). I tried to solve the issue by using
the PrefetchPolicy feature, but that does not seem to have and impact on
how much messages are kept in LRUCache. Is it possible to specify the
amount of messages kept in the LRUCache? How ?

 Here are the versions of the plugins/frameworks I am using:
Activemq         5.4.0
JMS                 0.5.1
xbean-spring   3.6
Grails               1.3.6
Java                 1.6
I am using topics and non-persistent messaging.

Thank you very much

-- 


*Jean Silga *
Software Engineer at Netvitesse
+33 (0) 9 72 22 44 10

Re: How can I limit the amount of messages kept in LRUCache?

Posted by Timothy Bish <ta...@gmail.com>.
On 06/06/2013 06:09 AM, Jean Silga wrote:
> Can anyone help me with this?
Doubt anyone can help until you provide some more specific on which 
LRUCache instance you are referring to since its used in several places 
throughout the client and broker code.

>
> On Wed, Jun 5, 2013 at 6:24 PM, Jean Silga <je...@net-vitesse.com>wrote:
>
>> I tried in two places without success.:
>>
>> 1) In the destination policy of the broker
>>
>> amq.'broker'(id: 'broker', brokerName: 'localhost', useJmx: true,
>>                  persistent: false, advisorySupport='true') {
>>                      amq.'managementContext' {
>>                          amq.'managementContext'(connectorPort: 2011,
>>                                  jmxDomainName: 'embeddedBroker')
>>                      }
>>
>>                      amq.'systemUsage' {
>>                          amq.'systemUsage' {
>>                              amq.'memoryUsage' {
>>                                  amq.'memoryUsage'(limit:"200 mb")
>>                              }
>>                          }
>>                      }
>>
>>                    *  amq.'destinationPolicy' {*
>>                          amq.'policyMap' {
>>                              amq.'policyEntries' {
>>                                  amq.'policyEntry'(topic: "index.mixml",
>> memoryLimit: "100mb")
>>                                  amq.'policyEntry'(topic:
>> "index.onedirectory", memoryLimit: "150mb")
>> *                                amq.'policyEntry'(topic:
>> "index.onedirectory", durableTopicPrefetch: "2")
>>                                  amq.'policyEntry'(topic:
>> "index.onedirectory", topicPrefetch: "2")*
>>
>>                              }
>>                          }
>> *                    }*
>>
>>                      amq.'plugins' {
>>                          amq.'loggingBrokerPlugin'
>>                      }
>>
>>                      if (Environment.current != Environment.TEST) {
>>                          amq.'transportConnectors' {
>>                              amq.'transportConnector'(name: 'connector1',
>> uri:'nio://0.0.0.0:61616')
>>                              amq.'transportConnector'(name: 'connector2',
>> uri:'vm://localhost')
>>                              if (nvconnect.clustering == true &&
>> Environment.current == Environment.PRODUCTION)
>>                                  amq.'transportConnector'(uri: 'tcp://
>> 0.0.0.0:0',
>>
>> discoveryUri:'multicast://default?group=nvconnect')
>>                          }
>>                      }
>>
>>                      if (nvconnect.clustering == true &&
>> Environment.current == Environment.PRODUCTION) {
>>                          amq.'networkConnectors' {
>>                              amq.'networkConnector'(uri:
>> 'multicast://default?group=nvconnect', duplex: "true", dynamicOnly: "true",
>> prefetchSize:5) {
>>                                  amq.'dynamicallyIncludedDestinations'{
>>                                      amq.'topic'(physicalName:'index.mixml')
>>
>> amq.'topic'(physicalName:'index.mixml.response')
>>
>> amq.'topic'(physicalName:'index.onedirectory')
>>
>> amq.'topic'(physicalName:'index.onedirectory.response')
>>                                  }
>>                              }
>>                          }
>>                      }
>>                  }
>>
>>
>> 2) In the connection factory
>>
>>
>> jmsConnectionFactory(org.springframework.jms.connection.SingleConnectionFactory)
>> { bean ->
>>              bean.dependsOn = "broker"
>>              clientId = "nv-jms-connection-" + UUID.randomUUID()
>>              targetConnectionFactory = {
>> org.apache.activemq.ActiveMQConnectionFactory cf ->
>>                  brokerURL ='vm://localhost'
>>                *  prefetchPolicy = ref("customPrefetchPolicy")*
>>              }
>>          }
>>
>> *
>> customPrefetchPolicy(org.apache.activemq.ActiveMQPrefetchPolicy){ bean ->
>>             topicPrefetch=2
>>             durableTopicPrefetch=2
>>          }*
>>
>>
>> "OnedirectoryIndexJmsListenerContainer"(org.springframework.jms.listener.DefaultMessageListenerContainer)
>> {
>>               it.'abstract' = true
>>               pubSubDomain = true
>>               autoStartup = false
>>               concurrentConsumers = 1
>>               subscriptionDurable = true
>> *             connectionFactory = ref("jmsConnectionFactory")*
>>               messageSelector = null
>>               cacheLevel = DefaultMessageListenerContainer.CACHE_SESSION
>>               durableSubscriptionName = "onedirectory.index-" +
>> UUID.randomUUID()
>>           }
>>
>>
>>
>>
>> On Wed, Jun 5, 2013 at 6:05 PM, Christian Posta <christian.posta@gmail.com
>>> wrote:
>>> yes, that's used in many places. where in the broker are you trying to
>>> tune
>>> it? the store?
>>>
>>>
>>> On Wed, Jun 5, 2013 at 9:00 AM, Jean Silga <jean.silga@net-vitesse.com
>>>> wrote:
>>>> I am talking about this LRUCache: org.apache.activemq.util.LRUCache.
>>>>
>>>>
>>>> On Wed, Jun 5, 2013 at 5:45 PM, Christian Posta
>>>> <ch...@gmail.com>wrote:
>>>>
>>>>> Which LRUCache are you talking about?
>>>>>
>>>>>
>>>>>
>>>>> On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <
>>> jean.silga@net-vitesse.com
>>>>>> wrote:
>>>>>> Hi guys
>>>>>>
>>>>>> We are currently using activemq for one of our project and we run
>>> into
>>>>> some
>>>>>> out of memory trouble lately. Our application performs some caching
>>>> every
>>>>>> two hours: It reads the information to cache, encapsulates it in an
>>>>>> ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object
>>>> to a
>>>>>> topic so that the consumer can receive it and perform the caching.
>>> The
>>>>>> problem is that  the LRUCache is keeping up to 100 messages in its
>>>> cache
>>>>>> (maxCacheSize=100), and this is causing an out of memory error
>>> because
>>>>> each
>>>>>> message is quite big (10 MB of size). I tried to solve the issue by
>>>> using
>>>>>> the PrefetchPolicy feature, but that does not seem to have and
>>> impact
>>>> on
>>>>>> how much messages are kept in LRUCache. Is it possible to specify
>>> the
>>>>>> amount of messages kept in the LRUCache? How ?
>>>>>>
>>>>>>   Here are the versions of the plugins/frameworks I am using:
>>>>>> Activemq         5.4.0
>>>>>> JMS                 0.5.1
>>>>>> xbean-spring   3.6
>>>>>> Grails               1.3.6
>>>>>> Java                 1.6
>>>>>> I am using topics and non-persistent messaging.
>>>>>>
>>>>>> Thank you very much
>>>>>>
>>>>>> --
>>>>>>
>>>>>>
>>>>>> *Jean Silga *
>>>>>> Software Engineer at Netvitesse
>>>>>> +33 (0) 9 72 22 44 10
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> *Christian Posta*
>>>>> http://www.christianposta.com/blog
>>>>> twitter: @christianposta
>>>>>
>>>>
>>>>
>>>> --
>>>>
>>>>
>>>> *Jean Silga *
>>>> Software Engineer at Netvitesse
>>>> +33 (0) 9 72 22 44 10
>>>>
>>>
>>>
>>> --
>>> *Christian Posta*
>>> http://www.christianposta.com/blog
>>> twitter: @christianposta
>>>
>>
>>
>> --
>>
>>
>> *Jean Silga *
>> Software Engineer at Netvitesse
>> +33 (0) 9 72 22 44 10
>>
>
>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.fusesource.com | www.redhat.com
skype: tabish121 | twitter: @tabish121
blog: http://timbish.blogspot.com/

www.camelone.org : The open source integration conference:


Re: How can I limit the amount of messages kept in LRUCache?

Posted by Jean Silga <je...@net-vitesse.com>.
Can anyone help me with this?


On Wed, Jun 5, 2013 at 6:24 PM, Jean Silga <je...@net-vitesse.com>wrote:

> I tried in two places without success.:
>
> 1) In the destination policy of the broker
>
> amq.'broker'(id: 'broker', brokerName: 'localhost', useJmx: true,
>                 persistent: false, advisorySupport='true') {
>                     amq.'managementContext' {
>                         amq.'managementContext'(connectorPort: 2011,
>                                 jmxDomainName: 'embeddedBroker')
>                     }
>
>                     amq.'systemUsage' {
>                         amq.'systemUsage' {
>                             amq.'memoryUsage' {
>                                 amq.'memoryUsage'(limit:"200 mb")
>                             }
>                         }
>                     }
>
>                   *  amq.'destinationPolicy' {*
>                         amq.'policyMap' {
>                             amq.'policyEntries' {
>                                 amq.'policyEntry'(topic: "index.mixml",
> memoryLimit: "100mb")
>                                 amq.'policyEntry'(topic:
> "index.onedirectory", memoryLimit: "150mb")
> *                                amq.'policyEntry'(topic:
> "index.onedirectory", durableTopicPrefetch: "2")
>                                 amq.'policyEntry'(topic:
> "index.onedirectory", topicPrefetch: "2")*
>
>                             }
>                         }
> *                    }*
>
>                     amq.'plugins' {
>                         amq.'loggingBrokerPlugin'
>                     }
>
>                     if (Environment.current != Environment.TEST) {
>                         amq.'transportConnectors' {
>                             amq.'transportConnector'(name: 'connector1',
> uri:'nio://0.0.0.0:61616')
>                             amq.'transportConnector'(name: 'connector2',
> uri:'vm://localhost')
>                             if (nvconnect.clustering == true &&
> Environment.current == Environment.PRODUCTION)
>                                 amq.'transportConnector'(uri: 'tcp://
> 0.0.0.0:0',
>
> discoveryUri:'multicast://default?group=nvconnect')
>                         }
>                     }
>
>                     if (nvconnect.clustering == true &&
> Environment.current == Environment.PRODUCTION) {
>                         amq.'networkConnectors' {
>                             amq.'networkConnector'(uri:
> 'multicast://default?group=nvconnect', duplex: "true", dynamicOnly: "true",
> prefetchSize:5) {
>                                 amq.'dynamicallyIncludedDestinations'{
>                                     amq.'topic'(physicalName:'index.mixml')
>
> amq.'topic'(physicalName:'index.mixml.response')
>
> amq.'topic'(physicalName:'index.onedirectory')
>
> amq.'topic'(physicalName:'index.onedirectory.response')
>                                 }
>                             }
>                         }
>                     }
>                 }
>
>
> 2) In the connection factory
>
>
> jmsConnectionFactory(org.springframework.jms.connection.SingleConnectionFactory)
> { bean ->
>             bean.dependsOn = "broker"
>             clientId = "nv-jms-connection-" + UUID.randomUUID()
>             targetConnectionFactory = {
> org.apache.activemq.ActiveMQConnectionFactory cf ->
>                 brokerURL ='vm://localhost'
>               *  prefetchPolicy = ref("customPrefetchPolicy")*
>             }
>         }
>
> *
> customPrefetchPolicy(org.apache.activemq.ActiveMQPrefetchPolicy){ bean ->
>            topicPrefetch=2
>            durableTopicPrefetch=2
>         }*
>
>
> "OnedirectoryIndexJmsListenerContainer"(org.springframework.jms.listener.DefaultMessageListenerContainer)
> {
>              it.'abstract' = true
>              pubSubDomain = true
>              autoStartup = false
>              concurrentConsumers = 1
>              subscriptionDurable = true
> *             connectionFactory = ref("jmsConnectionFactory")*
>              messageSelector = null
>              cacheLevel = DefaultMessageListenerContainer.CACHE_SESSION
>              durableSubscriptionName = "onedirectory.index-" +
> UUID.randomUUID()
>          }
>
>
>
>
> On Wed, Jun 5, 2013 at 6:05 PM, Christian Posta <christian.posta@gmail.com
> > wrote:
>
>> yes, that's used in many places. where in the broker are you trying to
>> tune
>> it? the store?
>>
>>
>> On Wed, Jun 5, 2013 at 9:00 AM, Jean Silga <jean.silga@net-vitesse.com
>> >wrote:
>>
>> > I am talking about this LRUCache: org.apache.activemq.util.LRUCache.
>> >
>> >
>> > On Wed, Jun 5, 2013 at 5:45 PM, Christian Posta
>> > <ch...@gmail.com>wrote:
>> >
>> > > Which LRUCache are you talking about?
>> > >
>> > >
>> > >
>> > > On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <
>> jean.silga@net-vitesse.com
>> > > >wrote:
>> > >
>> > > > Hi guys
>> > > >
>> > > > We are currently using activemq for one of our project and we run
>> into
>> > > some
>> > > > out of memory trouble lately. Our application performs some caching
>> > every
>> > > > two hours: It reads the information to cache, encapsulates it in an
>> > > > ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object
>> > to a
>> > > > topic so that the consumer can receive it and perform the caching.
>> The
>> > > > problem is that  the LRUCache is keeping up to 100 messages in its
>> > cache
>> > > > (maxCacheSize=100), and this is causing an out of memory error
>> because
>> > > each
>> > > > message is quite big (10 MB of size). I tried to solve the issue by
>> > using
>> > > > the PrefetchPolicy feature, but that does not seem to have and
>> impact
>> > on
>> > > > how much messages are kept in LRUCache. Is it possible to specify
>> the
>> > > > amount of messages kept in the LRUCache? How ?
>> > > >
>> > > >  Here are the versions of the plugins/frameworks I am using:
>> > > > Activemq         5.4.0
>> > > > JMS                 0.5.1
>> > > > xbean-spring   3.6
>> > > > Grails               1.3.6
>> > > > Java                 1.6
>> > > > I am using topics and non-persistent messaging.
>> > > >
>> > > > Thank you very much
>> > > >
>> > > > --
>> > > >
>> > > >
>> > > > *Jean Silga *
>> > > > Software Engineer at Netvitesse
>> > > > +33 (0) 9 72 22 44 10
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > *Christian Posta*
>> > > http://www.christianposta.com/blog
>> > > twitter: @christianposta
>> > >
>> >
>> >
>> >
>> > --
>> >
>> >
>> > *Jean Silga *
>> > Software Engineer at Netvitesse
>> > +33 (0) 9 72 22 44 10
>> >
>>
>>
>>
>> --
>> *Christian Posta*
>> http://www.christianposta.com/blog
>> twitter: @christianposta
>>
>
>
>
> --
>
>
> *Jean Silga *
> Software Engineer at Netvitesse
> +33 (0) 9 72 22 44 10
>



-- 


*Jean Silga *
Software Engineer at Netvitesse
+33 (0) 9 72 22 44 10

Re: How can I limit the amount of messages kept in LRUCache?

Posted by Jean Silga <je...@net-vitesse.com>.
I tried in two places without success.:

1) In the destination policy of the broker

amq.'broker'(id: 'broker', brokerName: 'localhost', useJmx: true,
                persistent: false, advisorySupport='true') {
                    amq.'managementContext' {
                        amq.'managementContext'(connectorPort: 2011,
                                jmxDomainName: 'embeddedBroker')
                    }

                    amq.'systemUsage' {
                        amq.'systemUsage' {
                            amq.'memoryUsage' {
                                amq.'memoryUsage'(limit:"200 mb")
                            }
                        }
                    }

                  *  amq.'destinationPolicy' {*
                        amq.'policyMap' {
                            amq.'policyEntries' {
                                amq.'policyEntry'(topic: "index.mixml",
memoryLimit: "100mb")
                                amq.'policyEntry'(topic:
"index.onedirectory", memoryLimit: "150mb")
*                                amq.'policyEntry'(topic:
"index.onedirectory", durableTopicPrefetch: "2")
                                amq.'policyEntry'(topic:
"index.onedirectory", topicPrefetch: "2")*

                            }
                        }
*                    }*

                    amq.'plugins' {
                        amq.'loggingBrokerPlugin'
                    }

                    if (Environment.current != Environment.TEST) {
                        amq.'transportConnectors' {
                            amq.'transportConnector'(name: 'connector1',
uri:'nio://0.0.0.0:61616')
                            amq.'transportConnector'(name: 'connector2',
uri:'vm://localhost')
                            if (nvconnect.clustering == true &&
Environment.current == Environment.PRODUCTION)
                                amq.'transportConnector'(uri: 'tcp://
0.0.0.0:0',

discoveryUri:'multicast://default?group=nvconnect')
                        }
                    }

                    if (nvconnect.clustering == true && Environment.current
== Environment.PRODUCTION) {
                        amq.'networkConnectors' {
                            amq.'networkConnector'(uri:
'multicast://default?group=nvconnect', duplex: "true", dynamicOnly: "true",
prefetchSize:5) {
                                amq.'dynamicallyIncludedDestinations'{
                                    amq.'topic'(physicalName:'index.mixml')

amq.'topic'(physicalName:'index.mixml.response')

amq.'topic'(physicalName:'index.onedirectory')

amq.'topic'(physicalName:'index.onedirectory.response')
                                }
                            }
                        }
                    }
                }


2) In the connection factory


jmsConnectionFactory(org.springframework.jms.connection.SingleConnectionFactory)
{ bean ->
            bean.dependsOn = "broker"
            clientId = "nv-jms-connection-" + UUID.randomUUID()
            targetConnectionFactory = {
org.apache.activemq.ActiveMQConnectionFactory cf ->
                brokerURL ='vm://localhost'
              *  prefetchPolicy = ref("customPrefetchPolicy")*
            }
        }

*        customPrefetchPolicy(org.apache.activemq.ActiveMQPrefetchPolicy){
bean ->
           topicPrefetch=2
           durableTopicPrefetch=2
        }*


"OnedirectoryIndexJmsListenerContainer"(org.springframework.jms.listener.DefaultMessageListenerContainer)
{
             it.'abstract' = true
             pubSubDomain = true
             autoStartup = false
             concurrentConsumers = 1
             subscriptionDurable = true
*             connectionFactory = ref("jmsConnectionFactory")*
             messageSelector = null
             cacheLevel = DefaultMessageListenerContainer.CACHE_SESSION
             durableSubscriptionName = "onedirectory.index-" +
UUID.randomUUID()
         }




On Wed, Jun 5, 2013 at 6:05 PM, Christian Posta
<ch...@gmail.com>wrote:

> yes, that's used in many places. where in the broker are you trying to tune
> it? the store?
>
>
> On Wed, Jun 5, 2013 at 9:00 AM, Jean Silga <jean.silga@net-vitesse.com
> >wrote:
>
> > I am talking about this LRUCache: org.apache.activemq.util.LRUCache.
> >
> >
> > On Wed, Jun 5, 2013 at 5:45 PM, Christian Posta
> > <ch...@gmail.com>wrote:
> >
> > > Which LRUCache are you talking about?
> > >
> > >
> > >
> > > On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <jean.silga@net-vitesse.com
> > > >wrote:
> > >
> > > > Hi guys
> > > >
> > > > We are currently using activemq for one of our project and we run
> into
> > > some
> > > > out of memory trouble lately. Our application performs some caching
> > every
> > > > two hours: It reads the information to cache, encapsulates it in an
> > > > ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object
> > to a
> > > > topic so that the consumer can receive it and perform the caching.
> The
> > > > problem is that  the LRUCache is keeping up to 100 messages in its
> > cache
> > > > (maxCacheSize=100), and this is causing an out of memory error
> because
> > > each
> > > > message is quite big (10 MB of size). I tried to solve the issue by
> > using
> > > > the PrefetchPolicy feature, but that does not seem to have and impact
> > on
> > > > how much messages are kept in LRUCache. Is it possible to specify the
> > > > amount of messages kept in the LRUCache? How ?
> > > >
> > > >  Here are the versions of the plugins/frameworks I am using:
> > > > Activemq         5.4.0
> > > > JMS                 0.5.1
> > > > xbean-spring   3.6
> > > > Grails               1.3.6
> > > > Java                 1.6
> > > > I am using topics and non-persistent messaging.
> > > >
> > > > Thank you very much
> > > >
> > > > --
> > > >
> > > >
> > > > *Jean Silga *
> > > > Software Engineer at Netvitesse
> > > > +33 (0) 9 72 22 44 10
> > > >
> > >
> > >
> > >
> > > --
> > > *Christian Posta*
> > > http://www.christianposta.com/blog
> > > twitter: @christianposta
> > >
> >
> >
> >
> > --
> >
> >
> > *Jean Silga *
> > Software Engineer at Netvitesse
> > +33 (0) 9 72 22 44 10
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>



-- 


*Jean Silga *
Software Engineer at Netvitesse
+33 (0) 9 72 22 44 10

Re: How can I limit the amount of messages kept in LRUCache?

Posted by Christian Posta <ch...@gmail.com>.
yes, that's used in many places. where in the broker are you trying to tune
it? the store?


On Wed, Jun 5, 2013 at 9:00 AM, Jean Silga <je...@net-vitesse.com>wrote:

> I am talking about this LRUCache: org.apache.activemq.util.LRUCache.
>
>
> On Wed, Jun 5, 2013 at 5:45 PM, Christian Posta
> <ch...@gmail.com>wrote:
>
> > Which LRUCache are you talking about?
> >
> >
> >
> > On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <jean.silga@net-vitesse.com
> > >wrote:
> >
> > > Hi guys
> > >
> > > We are currently using activemq for one of our project and we run into
> > some
> > > out of memory trouble lately. Our application performs some caching
> every
> > > two hours: It reads the information to cache, encapsulates it in an
> > > ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object
> to a
> > > topic so that the consumer can receive it and perform the caching. The
> > > problem is that  the LRUCache is keeping up to 100 messages in its
> cache
> > > (maxCacheSize=100), and this is causing an out of memory error because
> > each
> > > message is quite big (10 MB of size). I tried to solve the issue by
> using
> > > the PrefetchPolicy feature, but that does not seem to have and impact
> on
> > > how much messages are kept in LRUCache. Is it possible to specify the
> > > amount of messages kept in the LRUCache? How ?
> > >
> > >  Here are the versions of the plugins/frameworks I am using:
> > > Activemq         5.4.0
> > > JMS                 0.5.1
> > > xbean-spring   3.6
> > > Grails               1.3.6
> > > Java                 1.6
> > > I am using topics and non-persistent messaging.
> > >
> > > Thank you very much
> > >
> > > --
> > >
> > >
> > > *Jean Silga *
> > > Software Engineer at Netvitesse
> > > +33 (0) 9 72 22 44 10
> > >
> >
> >
> >
> > --
> > *Christian Posta*
> > http://www.christianposta.com/blog
> > twitter: @christianposta
> >
>
>
>
> --
>
>
> *Jean Silga *
> Software Engineer at Netvitesse
> +33 (0) 9 72 22 44 10
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta

Re: How can I limit the amount of messages kept in LRUCache?

Posted by Jean Silga <je...@net-vitesse.com>.
I am talking about this LRUCache: org.apache.activemq.util.LRUCache.


On Wed, Jun 5, 2013 at 5:45 PM, Christian Posta
<ch...@gmail.com>wrote:

> Which LRUCache are you talking about?
>
>
>
> On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <jean.silga@net-vitesse.com
> >wrote:
>
> > Hi guys
> >
> > We are currently using activemq for one of our project and we run into
> some
> > out of memory trouble lately. Our application performs some caching every
> > two hours: It reads the information to cache, encapsulates it in an
> > ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object to a
> > topic so that the consumer can receive it and perform the caching. The
> > problem is that  the LRUCache is keeping up to 100 messages in its cache
> > (maxCacheSize=100), and this is causing an out of memory error because
> each
> > message is quite big (10 MB of size). I tried to solve the issue by using
> > the PrefetchPolicy feature, but that does not seem to have and impact on
> > how much messages are kept in LRUCache. Is it possible to specify the
> > amount of messages kept in the LRUCache? How ?
> >
> >  Here are the versions of the plugins/frameworks I am using:
> > Activemq         5.4.0
> > JMS                 0.5.1
> > xbean-spring   3.6
> > Grails               1.3.6
> > Java                 1.6
> > I am using topics and non-persistent messaging.
> >
> > Thank you very much
> >
> > --
> >
> >
> > *Jean Silga *
> > Software Engineer at Netvitesse
> > +33 (0) 9 72 22 44 10
> >
>
>
>
> --
> *Christian Posta*
> http://www.christianposta.com/blog
> twitter: @christianposta
>



-- 


*Jean Silga *
Software Engineer at Netvitesse
+33 (0) 9 72 22 44 10

Re: How can I limit the amount of messages kept in LRUCache?

Posted by Christian Posta <ch...@gmail.com>.
Which LRUCache are you talking about?



On Wed, Jun 5, 2013 at 8:19 AM, Jean Silga <je...@net-vitesse.com>wrote:

> Hi guys
>
> We are currently using activemq for one of our project and we run into some
> out of memory trouble lately. Our application performs some caching every
> two hours: It reads the information to cache, encapsulates it in an
> ActiveMQObjectMessage object, sends the ActiveMQObjectMessage object to a
> topic so that the consumer can receive it and perform the caching. The
> problem is that  the LRUCache is keeping up to 100 messages in its cache
> (maxCacheSize=100), and this is causing an out of memory error because each
> message is quite big (10 MB of size). I tried to solve the issue by using
> the PrefetchPolicy feature, but that does not seem to have and impact on
> how much messages are kept in LRUCache. Is it possible to specify the
> amount of messages kept in the LRUCache? How ?
>
>  Here are the versions of the plugins/frameworks I am using:
> Activemq         5.4.0
> JMS                 0.5.1
> xbean-spring   3.6
> Grails               1.3.6
> Java                 1.6
> I am using topics and non-persistent messaging.
>
> Thank you very much
>
> --
>
>
> *Jean Silga *
> Software Engineer at Netvitesse
> +33 (0) 9 72 22 44 10
>



-- 
*Christian Posta*
http://www.christianposta.com/blog
twitter: @christianposta