On 28 May 2004, at 15:34, Ugo Cei wrote:
Stefano Mazzocchi wrote:what if I'm using jetty?
I don't know. We're currently using the bundled Jetty for development and Tomcat for staging/production. But my point still remains: it's better to crash and burn rather than try to survive if you get an OOMException.
Yeah, the problem is that you never "crash and burn" on OOMEs. The JVM doesn't itself exit.
You could (for instance) do something like:
try { ... } catch (OutOfMemoryError e) { System.exit(0); }
I've seen a lot of OOMEs happening just because the machine was simply overloaded, and in those situation doing a System.exit() was more harmful than simply letting that thread die.
When a thread (a request thread, for instance) dies because of an OOME, is _definitely_ going to free up a couple of objects, and having the JVM that bit of millisecond to re-sort itself out and clean up some memory after thread death...
Oh, on a side note, Ugo, I'd seriously switch your development/production environments... I'm not going into performance details (I don't want to raise a can of worms), but at least on my tests Tomcat is using 3x the memory that Jetty is using per single request, so it's more likely for you to have OOMEs on Tomcat rather than Jetty.
Pier
smime.p7s
Description: S/MIME cryptographic signature