Re: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Kees Jan Koster
Dear Todd, I'm not sure I can use session counting, as my session size is not consistent. I could try to estimate the size of each session, and keep a global counter, but that seems like a lot of work. JMX offers quite a bit of insight in what your GC is doing. You could implement throttling

RE: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Peter Crowther
> From: André Warnier [mailto:a...@ice-sa.com] > Thanks, Chuck and Peter, for the clarifications on OOM. > I believe that unconsciously, with my "large object > reservation" theory, > I was vaguely remembering something I had read some time in the past. > So I searched Google for "java +parachute +

Re: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread André Warnier
Thanks, Chuck and Peter, for the clarifications on OOM. I believe that unconsciously, with my "large object reservation" theory, I was vaguely remembering something I had read some time in the past. So I searched Google for "java +parachute +memory" and this is something I found : http://mail-

RE: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Caldarale, Charles R
> From: Todd Hivnor [mailto:spambox_98...@yahoo.com] > Subject: Re: Preventing OutOfMemoryError: Java heap space > > In my tests, as the RAM becomes depleted, the server > response becomes slower and slower. That's because you're going through garbage collecti

Re: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Rainer Jung
On 13.05.2009 08:07, Peter Crowther wrote: >> From: André Warnier [...@ice-sa.com] would it not be easier to catch >> the OOM exception and then return a "sorry, server overloaded" page >> to the browser ? > > At that point, it's too late. A thread, somewhere in the system, > tried to allocate so

RE: Preventing OutOfMemoryError: Java heap space

2009-05-13 Thread Peter Crowther
> From: Todd Hivnor [mailto:spambox_98...@yahoo.com] > One challenge with Peter's suggestion of tracking the > number of sessions myself is that I have a collection > of webapps. So I can't just set up a shared static counter; > I need a counter which works across multiple webapps. > The only way I

RE: Preventing OutOfMemoryError: Java heap space

2009-05-12 Thread Peter Crowther
> From: André Warnier [...@ice-sa.com] > would it not be easier to catch the OOM exception and then return a > "sorry, server overloaded" page to the browser ? At that point, it's too late. A thread, somewhere in the system, tried to allocate some memory for an object and couldn't. This could h

Re: Preventing OutOfMemoryError: Java heap space

2009-05-12 Thread Todd Hivnor
>> But would it not be easier to catch the OOM exception and then >> return a "sorry, server overloaded" page to the browser ? > It's difficult to do that when the OOME may occur in Tomcat code, > outside of control of the webapp. Wow I had assumed I could always catch this type of exception.

RE: Preventing OutOfMemoryError: Java heap space

2009-05-12 Thread Caldarale, Charles R
> From: André Warnier [mailto:a...@ice-sa.com] > Subject: Re: Preventing OutOfMemoryError: Java heap space > > > I'm going to add an explicit request for garbage > > collection, _before_ the memory becomes seriously > > depleted. To the OP: explicitly callin

Re: Preventing OutOfMemoryError: Java heap space

2009-05-12 Thread André Warnier
Todd Hivnor wrote: From: Todd Hivnor [spambox_98...@yahoo.com] I would like to proactively avoid running out of heap space. I would like people get a "Server Too Busy" message, _before_ the heap is actually exhausted. I would rather serve 40 users well than 45 users poorly. Rather than moni

Re: Preventing OutOfMemoryError: Java heap space

2009-05-12 Thread Todd Hivnor
>> From: Todd Hivnor [spambox_98...@yahoo.com] >> I would like to proactively avoid running out of heap >> space. I would like people get a "Server Too Busy" >> message, _before_ the heap is actually exhausted. > >> I would rather serve 40 users well than 45 users >> poorly. > Rather than monito

RE: Preventing OutOfMemoryError: Java heap space

2009-05-11 Thread Peter Crowther
> From: Todd Hivnor [spambox_98...@yahoo.com] > I would like to proactively avoid running out of heap > space. I would like people get a "Server Too Busy" > message, _before_ the heap is actually exhausted. > I would rather serve 40 users well than 45 users > poorly. Rather than monitor memory, w

Re: Preventing OutOfMemoryError: Java heap space

2009-05-11 Thread George Sexton
I think the results are going to be pretty erratic. The issue that I see is that the garbage collector operation is (to my knowledge) not deterministic. IOW, you're not really accounting for memory that could be garbage collected. So, I think that you'll have a systematic bias showing less m

Preventing OutOfMemoryError: Java heap space

2009-05-11 Thread Todd Hivnor
I have a Java application running under Tomcat 6.0.18 on Ubuntu. This is using Sun's 1.6.0_07 JVM. I know how to set the max heap space by setting -Xmx256m in CATALINA_OPTS. But with a lot of sessions, I still have the possibility of running out of heap space. My application uses a lot of memo