Tomcat Memory and Garbage Collection questions...

View: New views
10 Messages — Rating Filter:   Alert me  

Parent Message unknown Tomcat Memory and Garbage Collection questions...

by Johnson, Trevin (Contractor) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello
OS Version: Windows 2000
Tomcat version:5.5.17
Initial Memory Pool: 768
Maximum Memory Pool:1024
Java Version: Java\jdk1.5.0_14

When we restart the tomcat service our tomcat memory is about 120Mb. It keeps going up over the next few days util it reaches 700Mb and we have to reboot the server. We do not see any errors just yet but the server gets close to maxing out
I have questions around garbage collection for tomcat

Questions:
1.We do not see the memory going down for the tomcat service. Shouldn't the memory go down as well as up over this timespan
2.Should the memory get to maximum 768Mb and then go back down or get recycled?
3.Is this a bug or what is normal behavior for the tomcat memory?

4.. How do we implement garbage collection for our windows server(-Xincgc)?

I am very new to Tomcat and trying to manage/decrease the memory footprint used by Tomcat?
Your help is most appreciated...

Thanks
Trevin.johnson@...


RE: Tomcat Memory and Garbage Collection questions...

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Johnson, Trevin (Contractor)
> [mailto:Trevin.Johnson@...]
> Subject: Tomcat Memory and Garbage Collection questions...
>
> When we restart the tomcat service our tomcat memory is about 120Mb. It
> keeps going up over the next few days util it reaches 700Mb and we have
> to reboot the server.

Why do you reboot?  Is the server unresponsive?

> 1.We do not see the memory going down for the tomcat service. Shouldn't
> the memory go down as well as up over this timespan

What are you using to show the memory usage?

> 2.Should the memory get to maximum 768Mb and then go back down or get
> recycled?

Depends on what you're looking at.  If it's Task Manager, it won't go down.  If you're using JConsole to look at the heap, it should go up and down.

> 3.Is this a bug or what is normal behavior for the tomcat memory?

Depends; see above.

> 4.. How do we implement garbage collection for our windows server(-
> Xincgc)?

Garbage collection is always present.  Incremental GC can be useful to minimize pause times, but it is more overhead and has some restrictions on just what it can collect.  Unless you really think you need that option, I wouldn't set it right now.

I'd strongly recommend using JConsole to look at heap usage, then use a profiler if you find that the heap usage does not stabilize.  You can also turn on -verbose:gc, and use jhat and jmap to do basic heap analysis.

Some useful resources:
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html
http://java.sun.com/javase/technologies/hotspot/gc/index.jsp

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Tomcat Memory and Garbage Collection questions...

by Martin Choma :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

in fact, garbage collection is not tomcat stuff. It is JVM responsibility.

So try to focus on jvm memory problem, not tomcat memory problem.
Maybe some memory leak?

Martin

2009/11/2 Johnson, Trevin (Contractor) <Trevin.Johnson@...>:

> Hello
> OS Version: Windows 2000
> Tomcat version:5.5.17
> Initial Memory Pool: 768
> Maximum Memory Pool:1024
> Java Version: Java\jdk1.5.0_14
>
> When we restart the tomcat service our tomcat memory is about 120Mb. It keeps going up over the next few days util it reaches 700Mb and we have to reboot the server. We do not see any errors just yet but the server gets close to maxing out
> I have questions around garbage collection for tomcat
>
> Questions:
> 1.We do not see the memory going down for the tomcat service. Shouldn't the memory go down as well as up over this timespan
> 2.Should the memory get to maximum 768Mb and then go back down or get recycled?
> 3.Is this a bug or what is normal behavior for the tomcat memory?
>
> 4.. How do we implement garbage collection for our windows server(-Xincgc)?
>
> I am very new to Tomcat and trying to manage/decrease the memory footprint used by Tomcat?
> Your help is most appreciated...
>
> Thanks
> Trevin.johnson@...
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Tomcat Memory and Garbage Collection questions...

by Joseph Morgan-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I hope Mr. Caldarale answered your question, because you may otherwise
be looking at the 800lb Gorilla in the room.

Memory problems within Tomcat could be a number of very hard to see
things, but some quick candidates are:

* Programmers caching too much data from the DB (or file system) into
context attributes
* Programmers using context attributes to store session data
* Programmers pushing too much data into session attributes
* Session timeout is set too high and sessions aren't timing out

-----Original Message-----
From: Johnson, Trevin (Contractor) [mailto:Trevin.Johnson@...]

Sent: Monday, November 02, 2009 2:53 PM
To: 'users@...'
Subject: Tomcat Memory and Garbage Collection questions...

Hello
OS Version: Windows 2000
Tomcat version:5.5.17
Initial Memory Pool: 768
Maximum Memory Pool:1024
Java Version: Java\jdk1.5.0_14

When we restart the tomcat service our tomcat memory is about 120Mb. It
keeps going up over the next few days util it reaches 700Mb and we have
to reboot the server. We do not see any errors just yet but the server
gets close to maxing out
I have questions around garbage collection for tomcat

Questions:
1.We do not see the memory going down for the tomcat service. Shouldn't
the memory go down as well as up over this timespan
2.Should the memory get to maximum 768Mb and then go back down or get
recycled?
3.Is this a bug or what is normal behavior for the tomcat memory?

4.. How do we implement garbage collection for our windows
server(-Xincgc)?

I am very new to Tomcat and trying to manage/decrease the memory
footprint used by Tomcat?
Your help is most appreciated...

Thanks
Trevin.johnson@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


Re: Tomcat Memory and Garbage Collection questions...

by el al :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

A question:

Do you guys use hot deployment of applications? If you do *not*, then
Joseph’s tips are the first things to look at, in short it is the
application code keeping too many references.

If you do hot deployment, then the number of possibilities goes up
significantly. Now you are also talking about references to class loaders
and memory cleanup at shutdown, which is another topic altogether.
E

On Mon, Nov 2, 2009 at 1:44 PM, Joseph Morgan <joseph.morgan@...
> wrote:

> I hope Mr. Caldarale answered your question, because you may otherwise
> be looking at the 800lb Gorilla in the room.
>
> Memory problems within Tomcat could be a number of very hard to see
> things, but some quick candidates are:
>
> * Programmers caching too much data from the DB (or file system) into
> context attributes
> * Programmers using context attributes to store session data
> * Programmers pushing too much data into session attributes
> * Session timeout is set too high and sessions aren't timing out

RE: Tomcat Memory and Garbage Collection questions...

by Gerwood Stewart-4 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Elli

Thanks for the reply. I also missed josephs (unless there is several of these threads going on).

Hot deployment is what we would like to do. It's not possible as yet because of eventual permgen memory errors. I also (in general) think it's a good idea to _know what we're doing_ so some of this is trying to ensure the apps we're building are healthy.

I think an initial part of the problem is commons-logging. Specifically how we are using it. We have also found the cas-client-core needed to be updated to 3.1.8 as it had it's own issues. I've experimented with putting both commons-logging and log4j in the tomcat library and that appears to work, but from some of the reading you guys have provided I suspect that commons logging should probably be in the context and log4j in tomcat.

The comment about programmers pushing to much into session attributes is probably another candidate, though I suspect that is causing a slow down in the clean up and not a permanent problem (yet).

Shall continue the search...

Gerwood

________________________________________
From: Elli Albek [elli@...]
Sent: Tuesday, 3 November 2009 6:56 PM
To: Tomcat Users List
Subject: Re: Tomcat Memory and Garbage Collection questions...

A question:

Do you guys use hot deployment of applications? If you do *not*, then
Joseph’s tips are the first things to look at, in short it is the
application code keeping too many references.

If you do hot deployment, then the number of possibilities goes up
significantly. Now you are also talking about references to class loaders
and memory cleanup at shutdown, which is another topic altogether.
E

On Mon, Nov 2, 2009 at 1:44 PM, Joseph Morgan <joseph.morgan@...
> wrote:

> I hope Mr. Caldarale answered your question, because you may otherwise
> be looking at the 800lb Gorilla in the room.
>
> Memory problems within Tomcat could be a number of very hard to see
> things, but some quick candidates are:
>
> * Programmers caching too much data from the DB (or file system) into
> context attributes
> * Programmers using context attributes to store session data
> * Programmers pushing too much data into session attributes
> * Session timeout is set too high and sessions aren't timing out
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Tomcat Memory and Garbage Collection questions...

by Johnson, Trevin (Contractor) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I see odd behavior. Our tomcat setting is set for a max memory setting of 256Mb in our Development Environment. Yet it goes over 256Mb. Up to 290Mb. I assumed that it would never go over 256Mb in task manager. Is that correct?
thanks

Answers Below as well...

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@...]
Sent: Monday, November 02, 2009 4:06 PM
To: Tomcat Users List
Subject: RE: Tomcat Memory and Garbage Collection questions...

> From: Johnson, Trevin (Contractor)
> [mailto:Trevin.Johnson@...]
> Subject: Tomcat Memory and Garbage Collection questions...
>
> When we restart the tomcat service our tomcat memory is about 120Mb. It
> keeps going up over the next few days util it reaches 700Mb and we have
> to reboot the server.

Why do you reboot?  Is the server unresponsive?
-We actually just restart Tomcat service and it goes back down to about 120Mb

> 1.We do not see the memory going down for the tomcat service. Shouldn't
> the memory go down as well as up over this timespan

What are you using to show the memory usage?
-We are using task manager to show Tomcat memory usage

> 2.Should the memory get to maximum 768Mb and then go back down or get
> recycled?

Depends on what you're looking at.  If it's Task Manager, it won't go down.  If you're using JConsole to look at the heap, it should go up and down.

> 3.Is this a bug or what is normal behavior for the tomcat memory?

Depends; see above.

> 4.. How do we implement garbage collection for our windows server(-
> Xincgc)?

Garbage collection is always present.  Incremental GC can be useful to minimize pause times, but it is more overhead and has some restrictions on just what it can collect.  Unless you really think you need that option, I wouldn't set it right now.

I'd strongly recommend using JConsole to look at heap usage, then use a profiler if you find that the heap usage does not stabilize.  You can also turn on -verbose:gc, and use jhat and jmap to do basic heap analysis.

Some useful resources:
http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html
http://java.sun.com/javase/technologies/hotspot/gc/index.jsp

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Tomcat Memory and Garbage Collection questions...

by Caldarale, Charles R :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

> From: Johnson, Trevin (Contractor)
> [mailto:Trevin.Johnson@...]
> Subject: RE: Tomcat Memory and Garbage Collection questions...
>
> I see odd behavior. Our tomcat setting is set for a max memory setting
> of 256Mb in our Development Environment. Yet it goes over 256Mb. Up to
> 290Mb. I assumed that it would never go over 256Mb in task manager. Is
> that correct?

Your assumption is incorrect.  The Java heap limit is only part of the total process space, which is what Task Manager is showing; also included in the process space is code, the C heap, stacks, and lots of OS overhead.  Task Manager is a dismally poor means of discovering any real information.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...


RE: Tomcat Memory and Garbage Collection questions...

by mgainty :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


you're going to want to trap the stack and heap parameters with all the tools chuck mentioned
you're going to want to note which webapps are being loaded and where (do you have a cluster)
track ALL the resource changes you make specifically Database resources which can consume unrestricted heap as well any any file i/o or graphic packages loaded

in the end run heap space not being reclaimed can be caused by a thousand different things

we can provide a comprehensive solution if we would be able to submit bids for a statement of work where one of us will come down and take a look

thanks,
Martin Gainty
______________________________________________
do not modify or alter this transmission. Thank You




> From: Trevin.Johnson@...
> To: users@...
> Date: Thu, 5 Nov 2009 17:26:14 -0500
> Subject: RE: Tomcat Memory and Garbage Collection questions...
>
> I see odd behavior. Our tomcat setting is set for a max memory setting of 256Mb in our Development Environment. Yet it goes over 256Mb. Up to 290Mb. I assumed that it would never go over 256Mb in task manager. Is that correct?
> thanks
>
> Answers Below as well...
>
> -----Original Message-----
> From: Caldarale, Charles R [mailto:Chuck.Caldarale@...]
> Sent: Monday, November 02, 2009 4:06 PM
> To: Tomcat Users List
> Subject: RE: Tomcat Memory and Garbage Collection questions...
>
> > From: Johnson, Trevin (Contractor)
> > [mailto:Trevin.Johnson@...]
> > Subject: Tomcat Memory and Garbage Collection questions...
> >
> > When we restart the tomcat service our tomcat memory is about 120Mb. It
> > keeps going up over the next few days util it reaches 700Mb and we have
> > to reboot the server.
>
> Why do you reboot?  Is the server unresponsive?
> -We actually just restart Tomcat service and it goes back down to about 120Mb
>
> > 1.We do not see the memory going down for the tomcat service. Shouldn't
> > the memory go down as well as up over this timespan
>
> What are you using to show the memory usage?
> -We are using task manager to show Tomcat memory usage
>
> > 2.Should the memory get to maximum 768Mb and then go back down or get
> > recycled?
>
> Depends on what you're looking at.  If it's Task Manager, it won't go down.  If you're using JConsole to look at the heap, it should go up and down.
>
> > 3.Is this a bug or what is normal behavior for the tomcat memory?
>
> Depends; see above.
>
> > 4.. How do we implement garbage collection for our windows server(-
> > Xincgc)?
>
> Garbage collection is always present.  Incremental GC can be useful to minimize pause times, but it is more overhead and has some restrictions on just what it can collect.  Unless you really think you need that option, I wouldn't set it right now.
>
> I'd strongly recommend using JConsole to look at heap usage, then use a profiler if you find that the heap usage does not stabilize.  You can also turn on -verbose:gc, and use jhat and jmap to do basic heap analysis.
>
> Some useful resources:
> http://java.sun.com/j2se/1.5.0/docs/guide/vm/gc-ergonomics.html
> http://java.sun.com/javase/technologies/hotspot/gc/index.jsp
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@...
> For additional commands, e-mail: users-help@...
>
     
_________________________________________________________________
Find the right PC with Windows 7 and Windows Live.
http://www.microsoft.com/Windows/pc-scout/laptop-set-criteria.aspx?cbid=wl&filt=200,2400,10,19,1,3,1,7,50,650,2,12,0,1000&cat=1,2,3,4,5,6&brands=5,6,7,8,9,10,11,12,13,14,15,16&addf=4,5,9&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:112009

Re: Tomcat Memory and Garbage Collection questions...

by Christopher Schultz-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Trevin,

On 11/5/2009 5:26 PM, Johnson, Trevin (Contractor) wrote:
> I see odd behavior. Our tomcat setting is set for a max memory
> setting of 256Mb in our Development Environment. Yet it goes over
> 256Mb. Up to 290Mb. I assumed that it would never go over 256Mb in
> task manager. Is that correct?

Is the "odd behavior" you describe the failure of your process to stay
below 256MiB of memory allocation? See Chuck's response for why your
process can (and will) take up more than just the heap.

I also seem to recall that, even as the heap expands and contracts (say,
between some arbitrarily small size and somewhere just shy of 256MiB),
the JVM will never release memory back to the operating system for use
by other programs. I'm not sure if this is just on Microsoft Windows or
also on other systems, but I have observed it myself and it's nothing to
worry about -- assuming your Java processes are sufficiently
high-priority that allowing them to retain this system is acceptable.

If you're just seeing your JVM take more than the max heap space you
expected, then you need to change your expectations. If nothing else
seems amiss, I'd say your server is probably running rather well.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkr00AsACgkQ9CaO5/Lv0PCTRACgmc6N3lewsDYfsrXtzfcOpPTh
xyIAmwZXdzX+wIwNMe53ErUWPqfexl+I
=BHvu
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@...
For additional commands, e-mail: users-help@...