tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier>
Subject Re: memory heap size
Date Tue, 14 Feb 2012 13:55:42 GMT
Alfredo Alessandrini wrote:
> Hi,
> I'm running tomcat 7.0.25 in a shared server (centOS 64bit).
> Memory limit for my account is 256m.
> I'm running tomcat with this settings:

No, you are not. See [1] below.

> export CATALINA_OPTS="-Xms128m -Xmx256m"
> export JAVA_OPTS="-Xms128m -Xmx256m"
> But the process exceed the limit that I've set:
> 318340 01:14 37152 /home/keol/java/bin/java
> -Djava.util.logging.config.file=/home/keol/webapps/tomcat/conf/

> -Xms64m -Xmx128m  [1] <-- this is what you are really running with

> -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager

> -Xms64m -Xmx128m  [1] <-- and this ??

> -Djava.endorsed.dirs=/home/keol/webapps/tomcat/endorsed -classpath
> /home/keol/webapps/tomcat/bin/bootstrap.jar:/home/keol/webapps/tomcat/bin/tomcat-juli.jar
> -Dcatalina.base=/home/keol/webapps/tomcat
> -Dcatalina.home=/home/keol/webapps/tomcat
> org.apache.catalina.startup.Bootstrap start
> There is a way to limit the memory usage?

Item #1 :
the -Xms...M and -Xmx...M command-line switches for Java, represent respectively
-Xms...M : the number of MB allocated to the Java Heap when Java starts
-Xmx...M : the maximum number of MB that Java is allowed to use for the Heap

The Heap is only one part of the memory used by the Java process.  You still have to load

the Java JVM code, the classes of the application (Tomcat), the classes of your webapps, 
the JVM stack, etc..
  So if you are only allowed to use 256MB in total, my guess would be that you'd better 
limit the Heap to 64MB or so (maybe 128MB).  Anyway, apart from relatively simple 
applications, that is not a whole lot for running Tomcat..

Item #2:  the parameters which you are specifying in
 > export CATALINA_OPTS="-Xms128m -Xmx256m"
 > export JAVA_OPTS="-Xms128m -Xmx256m"
are obviously not the ones that the running Tomcat process is using, since it says 
differently in your "ps" display.

Item #3: whatever parameters you are really using, seem to be added 2 times to the Java 
command-line (see [1] above).

So apart from your basic question, there is something wrong in your configuration.

Where is that Tomcat from ? how was it installed ? how is it being started ?

P.S. I would add that choosing an installation path for Tomcat, which contains "webapps" 
at a level above the Tomcat installation directory, is maybe not the best choice, if you 
want to avoid confusion later.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message