If you know that no or only few users are currently logged in, you can trigger System.gc() yourself.
I think Tomcat has no reliable way to know how "busy" its webapps currently are.


Durfee, Bernard wrote:
I'd rather have a major garbage collection kick off with no users logged
in vs. 100 users logged in. My application pulls data from a database
and generates charts on the fly. Both of those operations require object
creation. So my heap usage grows over time. My usage trends tend to be
bunched, rather than constant. So in my case, more predictable garbage
collection would be a great benefit.

Bernard Durfee


-----Original Message-----
From: Christoph Kutzinski [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 12, 2005 4:32 PM
To: Tomcat Users List
Subject: Re: Garbage Collection



Calling System.gc() is considered to be a bad thing since this would trigger a "major" garbage collection which would take relatively long, compared with a minor collection.
Besides this: Tomcat knows that it has nothing to do in right this moment. But does that mean that is always a good idea to make a GC now?
No, maybe one millisecond later a new request will arrive and if Tomcat is then in GC, it is busy and cannot handle the request.
I think this is the reason why Tomcat doesn't call the GC itself.


Christoph

Durfee, Bernard wrote:

Right, my question was whether or not Tomcat would call System.gc() to


'suggest' to the JVM that garbage collection take place. Tomcat itself


is the best authority as to how busy it is. Since Tomcat has been around for a long time I figured that this might have been implemented


at some point.

Bernard Durfee


-----Original Message----- From: Pete Guyatt [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 12, 2005 3:33 PM To: Tomcat Users List Subject: RE: Garbage Collection


Hi There,

Tomcat does not control the garbage collection, it is up to the

JVM


to decide if and when a garbage collection is performed. The only way you can request a garbage collection is by using the System.gc() method, which the JVM can ignore.

For more information on this Topic read the documentation for the JVM that you are using.

Pete

-----Original Message-----
From: Durfee, Bernard [mailto:[EMAIL PROTECTED]
Sent: 12 April 2005 20:12
To: Tomcat Users List
Subject: Garbage Collection


How is garbage collection controlled in Tomcat 5.5? I ran a bit of an experiment by profiling Tomcat 5.5.7 while running a web application. I ran a load test against the application that finished with the allocated object size just below the heap size. If it grew any more, garbage collection would run. So the load test was done and with Tomcat idle, the garbage collector never ran. It would seem like a good time to run the garbage collector.


As is stands now the next person to hit the application will push the heap size over the limit and they will have to wait for garbage collection. Seems like Tomcat should either attempt to trigger the garbage collector when idle.

Bernard Durfee

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]


--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to