tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: Free Memory vs. Total Memory vs. Max Memory
Date Fri, 17 Feb 2012 08:28:31 GMT
Robinson, Eric wrote:
> What are the possible downsides of setting a low initial memory pool and
> a high max pool? If a tomcat app usually needs approximately 64MB of
> heap space, but sometimes as much as 300-400MB, would it cause any
> problems to set the initial pool to 16M and the max pool to 512M?
>  
It depends... ;-)

If you set different values to -Xms (at start) and -Xmx (maximum), then the JVM will spend

some amount of time allocating and de-allocating Heap memory dynamically as needed, to 
stay within these boundaries. If they are equal, then the JVM allocates it at start, and 
never has to worry about it later.
If your application needs 64MB of Heap space and you allocate only -Xms16M, then right at

the start the JVM will have to increase the Heap to 64MB (minimum); so why would you do that
?

If you are talking about a workstation, and for testing, then you can do whatever pleases

you and play around. If you are talking about a server, then the logical thing to do would

be to estimate how big a Heap you need in a maximum expected load situation, round that up

somewhat, and set -Xms and -Xmx both to that same value.
There are other command-line parameters to the JVM, which allow to ask the Garbage 
Collector to write a log, which can help in determining what the optimal Heap size would 
be, in your situation.  There is no "one size fits all".

Note that you are talking of "memory pool", which is a bit vague.  The -Xms and -Xmx 
parameters relate to how big the Heap is, which is only one part of the memory space 
needed by the JVM.


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


Mime
View raw message