Op vrijdag, 9 december 2011 16:11 schreef Pid <p...@pidster.com>:



On 09/12/2011 14:52, Martin O'Shea wrote:

> -----Original Message-----
> From: Caldarale, Charles R [mailto:chuck.caldar...@unisys.com]
> Sent: 09 Dec 2011 14 46
> To: Tomcat Users List
> Subject: RE: Tomcat memory allocation
>
>> From: Martin O'Shea [mailto:app...@dsl.pipex.com]
>> Subject: Tomcat memory allocation
>
>> Following advice found elsewhere on the internet
>
> Always to be taken with large chunks of salt.
>
>> set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m -XX:MaxPermSize=128m
>
> You would be better off using CATALINA_OPTS, since setting JAVA_OPTS
> pointlessly affects the shutdown script as well as the startup one.
>
>> I know that settings:
>> Xms128m -Xmx512m
>
>> Control the initial heap size and what it can expand to.
>
> In a server environment, you normally want Xms and Xmx set to the same value
> to avoid heap thrashing.  The exact size is completely dependent on what
> your webapps need.
>
>> But what exactly is:
>> -XX:MaxPermSize=128m
>
> It's the amount of space to which the so-called permanent generation can
> expand.  PermGen holds primarily instances of java.lang.Class, so it only
> needs to be specified if you have a large number of classes in your
> environment.
>
>> Should it be set to an addition of the other settings, or the other
>> settings to an addition of it?
>
> What does that question mean?  PermGen size is completely independent of the
> heap size.
>
> Make sure you have enough RAM available on the system to support the Xmx +
> PermGen + a_lot_of_other_stuff.  Monitor the system to make sure you're not
> getting into paging.
>
> > Thanks for this Chuck. I realise now what is happening. I thought the
> PermGen space was used in the heap when now I see it as just storing class
> definitions. So I could reduce it below 128Mb if I choose. Is there a
> default value?
>
> As to setting Xms and Xmx to the same, I will do that. A job hung earlier
> and I wonder if memory was to blame although there is nothing in the
system
> or server logs to say so.

Connect VisualVM to your Tomcat instance and use the monitor tab to
observe the actual PermGen usage.  It should be pretty stable, unless
you're doing something funky like generating classes or using RMI.

You'll then know how much you need to allocate.


p




--

[key:62590808]






Don't forget jstat also:
$ jstat -gc -h 10 -t 84762 3s
Timestamp S0C S1C S0U S1U EC EU OC OU PC PU YGC YGCT FGC FGCT GCT 700819.2 1792.0 1792.0 288.0 0.0 640.0 289.2 80320.0 61284.6 95296.0 95013.7 516 3.182 200 64.692 67.874
      700822.2 1792.0 1792.0 288.0   0.0    640.0    289.2    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
      700825.2 1792.0 1792.0 288.0   0.0    640.0    289.2    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
      700828.2 1792.0 1792.0 288.0   0.0    640.0    289.2    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
      700831.1 1792.0 1792.0 288.0   0.0    640.0    315.5    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
      700834.2 1792.0 1792.0 288.0   0.0    640.0    323.0    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
      700837.2 1792.0 1792.0 288.0   0.0    640.0    323.0    80320.0    
61284.6   95296.0 95013.7    516    3.182  200    64.692   67.874
Ronald.

Reply via email to