>> 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, 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 threshold. > - Peter Peter / George, thanks for the input. 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. I understand that garbage collection is, err, whimsical, but I think I'm going to give it a go anyway. I will keep in mind that the memory results from Runtime will probably under-report the available memory. I'm going to add an explicit request for garbage collection, _before_ the memory becomes seriously depleted. Thanks for the suggestions! --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org