RE: Memory pool Survivor space

2008-12-04 Thread Hubert de Heer
Andre,

Have a look at http://www.informit.com/guides/content.aspx?g=javaseqNum=253 
for more details about JVM.
A bit more difficult to read but with tons of info about JVM behaviour and 
default settings: http://java.sun.com/javase/technologies/hotspot/vmoptions.jsp

So for the SurvivorRatio the default setting is:
-XX:SurvivorRatio=8 Ratio of eden/survivor space size [Solaris amd64: 6; 
Sparc in 1.3.1: 25; other Solaris platforms in 5.0 and earlier: 32]

Hubert

-Original Message-
From: André Warnier [mailto:[EMAIL PROTECTED] 
Sent: 30 November 2008 15:54
To: Tomcat Users List
Subject: Memory pool Survivor space

Hi.

I am monitoring a Tomcat during startup, using jconsole.
This Tomcat's JVM is started with the switches -Xms200M -Xmx200M, and 
it starts a rather heavy webapp that just about occupies Tomcat 100% 
during 5 minutes whenever I start it. (*)

In the memory tab of jconsole, I observe that one of the display 
sections (Survivor space, the middle bar in the Heap section),
has the following behaviour :

- before the application is started, it remains constant at about 1 Mb
- as soon as I start the application, it grows to about 2 MB, then drops 
down to 0, then grows up again to 2Mb, then drops to about 1 Mb, then 
back up again, etc..
The 2 Mb seems to be some kind of hard limit, because it nevers goes 
over it.
The bottom is more variable, sometimes between 1 Mb and 0, but more 
often 0.
- when the application has finished loading (and Tomcat becomes 
responsive again), the amount of memory used by the Survivor space seems 
to stabilise again at 1.3 Mb, which is 0.3 Mb more than it was before 
the application started. Then it slowly over time drops down to 1 Mb.

If the attachment survives this post, then you can see this graphically 
in it. If not, you can get a snapshot here :
http://dev.dev.wissensbank.com/public/jconsole_survivor.png

What I would like to know is :
- what does this mean ?
- where does the JVM get this apparent hard limit of 2 Mb for this pool 
size ?
- does it matter ? I mean, assuming I could change it, would that have 
an impact in how the JVM works while starting this application, and how ?

Below are three cut and paste of the summary display at the bottom 
left of jconsole when displaying this pool.

1) at some point during app startup
Time: 
2008-11-30 15:27:24
Used: 
 0 kbytes
Committed: 
 2.240 kbytes
Max: 
 2.240 kbytes


2) also during app startup
Time: 
2008-11-30 15:28:33
Used: 
 2.240 kbytes
Committed: 
 2.240 kbytes
Max: 
 2.240 kbytes

3) after app is started
Time: 
2008-11-30 15:34:32
Used: 
 1.306 kbytes
Committed: 
 2.240 kbytes
Max: 
 2.240 kbytes


(*) to be completely precise :

- if I use load-on-startup in the web.xml of this application (no 
matter with which value), then it seems to get started when Tomcat is 
started. Whenever that happens, Tomcat becomes unresponsive during 
approximately 5 minutes, using 95% of the machine's cpu time and not 
answering HTTP requests.
At the end of these 5 minutes, Tomcat writes server startup in  ms 
in its catalina.out file, and it becomes responsive again to HTTP requests.

- if I do not have a load-on-startup tag in web.xml, then Tomcat 
prints server startup in  ms in catalina.out, and becomes 
responsive in about 15 seconds (instead of 5 minutes).
But then, it is when I first request the application in the browser that 
Tomcat becomes irresponsive during 5 minutes and uses 95% of cpu time 
during these 5 minutes.





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



RE: Memory pool Survivor space

2008-11-30 Thread Caldarale, Charles R
 From: André Warnier [mailto:[EMAIL PROTECTED]
 Subject: Memory pool Survivor space

 This Tomcat's JVM is started with the switches -Xms200M
 -Xmx200M

That's rather small for these days; I presume this is the toy machine you use 
to test with.

 In the memory tab of jconsole, I observe that one of the display
 sections (Survivor space, the middle bar in the Heap section),
 has the following behaviour :

All of your observations seem perfectly normal.

 - what does this mean ?

It means things are running properly.  Objects are born in Eden, live ones 
migrate to a Survivor space on each minor collection (Copy, on the JConsole 
picture), and reach Tenured only after staying in a Survivor space for some 
amount of time.  When Tenured fills up, you'll see a major collection 
(MarkSweepCompact).

 - where does the JVM get this apparent hard limit of 2 Mb for
 this pool size ?

The initial value is calculated during JVM initialization, and adjusted as 
needed as the JVM runs.

 - does it matter ? I mean, assuming I could change it, would
 that have an impact in how the JVM works while starting this
 application, and how ?

Yes, there are command line parameters to play with this (-XX:SurvivorRatio 
being the primary one for this area of the heap), but you will likely only make 
things worse.  Without faster, multiple CPUs and more memory, you're not likely 
to reduce the 1 minute spent in garbage collection during webapp initialization 
by any significant amount.  Rewriting or reconfiguring the webapp to be more 
efficient (including not creating so many objects) would buy you a lot more.

 - if I use load-on-startup in the web.xml of this application (no
 matter with which value), then it seems to get started when Tomcat is
 started.

Which is what load-on-startup is defined to do.  The value setting applies 
only to order servlet initializations within a single webapp; it is not a 
global value.  Tomcat initialization is serial, including processing any 
servlets marked with load-on-startup.

 - if I do not have a load-on-startup tag in web.xml, then Tomcat
 prints server startup in  ms in catalina.out, and becomes
 responsive in about 15 seconds (instead of 5 minutes).

Also expected, since your webapp's initialization is now deferred until the 
first request for it.  Since the system you're running on has less processing 
power than my phone, and your webapp seems to be a bit on the heavy side, it's 
going to take a while, regardless of when it happens.

 - 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 start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]