You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Donie Kelly <do...@tecnomen.ie> on 2002/09/27 12:12:23 UTC

HOW TO: How do I allocate memory in JVM for extra virtual hosts

Hi all
I am running tomcat 4.0.1 with virtual hosting and was wondering how much
memory to allocate to each additional host. By default, we use 64M for one
host but adding another 64M for second host seems excessive considering it's
the same tomcat instance.
However, if we add a lot the JVM will use more memory before garbage
collection and we've seen a 30 second (!!!) delay when using 1G Ram on JVM
as it just kept using memory until it ran out. It then had almost 1G of ram
to garbage collect. How can I force garbage collection to be more aggressive
and do it more often when garbage is small enough not to cause a problem?
As we need this to run in a production environment we cannot possible allow
a JVM to go for a garbage break for 30 seconds!!!!
Any insight or help is greatly appreciated.
Donie


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HOW TO: How do I allocate memory in JVM for extra virtual hosts

Posted by Glenn Nielsen <gl...@mail.more.net>.
Brad Plies wrote:
> I am not aware of all the performance implications of
> this, but it should be possible to create a Thread to
> run on some interval you define which just infinitely
> loops a call for garbage collection (gc() right?) then
> goes back to sleep until next iteration.
> 

This is a very bad idea.  The JVM is much better at knowing
when and how to do GC.  Especially the newer JVM's with HotSpot.

Regards,

Glenn


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: HOW TO: How do I allocate memory in JVM for extra virtual hosts

Posted by Brad Plies <pl...@yahoo.com>.
I am not aware of all the performance implications of
this, but it should be possible to create a Thread to
run on some interval you define which just infinitely
loops a call for garbage collection (gc() right?) then
goes back to sleep until next iteration.

At least then you can control how often garbage
collection happens, and I suppose it is possible that
doing it more regularly could imply less stuff needs
to be collected each iteration, than to wait for the
JVM to get the GC going.  Then again, maybe a GC
awakening, no matter how little the work, is a very
expensive process.  I don't know.

Anyway, if you absolutely need that kind of
performance, I do believe there are licenses available
for Realtime Garbage Collection engines.  At least Dr.
Mark Johnstone did his dissertation on them, so I
assume they exist somewhere.

--- Donie Kelly <do...@tecnomen.ie> wrote:
> Hi all
> I am running tomcat 4.0.1 with virtual hosting and
> was wondering how much
> memory to allocate to each additional host. By
> default, we use 64M for one
> host but adding another 64M for second host seems
> excessive considering it's
> the same tomcat instance.
> However, if we add a lot the JVM will use more
> memory before garbage
> collection and we've seen a 30 second (!!!) delay
> when using 1G Ram on JVM
> as it just kept using memory until it ran out. It
> then had almost 1G of ram
> to garbage collect. How can I force garbage
> collection to be more aggressive
> and do it more often when garbage is small enough
> not to cause a problem?
> As we need this to run in a production environment
> we cannot possible allow
> a JVM to go for a garbage break for 30 seconds!!!!
> Any insight or help is greatly appreciated.
> Donie
> 
> 
> --
> To unsubscribe, e-mail:  
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>