tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Crowther <>
Subject RE: Preventing OutOfMemoryError: Java heap space
Date Mon, 11 May 2009 20:05:12 GMT
> From: Todd Hivnor []
> 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, which is subject to GC whims as George points out, I'd suggest
monitoring the number of sessions in your application - find a number of sessions you can
live with, keep a (suitably synchronized) counter that's incremented and decremented as sessions
are created and destroyed, and don't start new sessions if that counter is higher than your

- Peter

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message