Discussion:
[openjms-developer] Memory Leaks?
Moore, Randy
2005-04-18 06:40:00 UTC
Permalink
Hi Again,

I've been experimenting with version 0.7.6.1 and am publishing objects (NONPERSISTANT) to a Topic via the TCP mode. At present I only have on subscriber running, but plan to have multiple ones. Anyway, I publish in bursts of 300 objects every 2.5 seconds, and my consumer gets all of them without problems. However. after I send out a total of around 50,000 objects, I get an out of memory exception in the JMSServer. I know I could increase the memory for the JVM, but it appears to me that would only delay the inevitable. We are probably dealing with a memory leak and I was curious if the latest CVS build may have some fixes for these types of problems. With the exception of this problem, I'm quite happy with OpenJMS. It gives me the messaging I need for a near real-time application, without the bloat of a fullup Web or Application server.

Thanks

Randy
Tim Anderson
2005-04-19 14:38:53 UTC
Permalink
There's a couple of things you can do:
1. publish messages with a non-zero timeToLive, so they expire
if a client doesn't consume them in time

2. use persistent messages
The garbage collector will clear any peristent messages
cached in memory, when memory is low.
See http://openjms.sourceforge.net/config/gc.html for details.

3. throttle your publisher
There are a few techniques you can use here, the
simplest being a Thread.sleep() between publications.

There's no new strategy for dealing with this yet in the
latest CVS, although it shouldn't be too hard to implement.

A couple of potential implementations would be to:
1. discard old NON_PERSISTENT messages when a particular
no. is reached
2. discard old NON_PERSISTENT messages when free memory falls
below a certain threshhold, irrespective of JMSExpiration property.
3. prevent publication of messages, once a particular no.
is reached.
4. prevent publication of messages when free memory falls
below a certain threshhold.

I suspect (2) would be the most useful, but I would be
interested to know what others think.

Thoughts?

-Tim
From: Moore, Randy
Hi Again,
I've been experimenting with version 0.7.6.1 and am
publishing objects (NONPERSISTANT) to a Topic via the TCP
mode. At present I only have on subscriber running, but plan
to have multiple ones. Anyway, I publish in bursts of 300
objects every 2.5 seconds, and my consumer gets all of them
without problems. However. after I send out a total of around
50,000 objects, I get an out of memory exception in the
JMSServer. I know I could increase the memory for the JVM,
but it appears to me that would only delay the inevitable. We
are probably dealing with a memory leak and I was curious if
the latest CVS build may have some fixes for these types of
problems. With the exception of this problem, I'm quite happy
with OpenJMS. It gives me the messaging I need for a near
real-time application, without the bloat of a fullup Web or
Application server.
Thanks
Randy
Continue reading on narkive:
Loading...