tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Peter Crowther" <>
Subject RE: Memory Management between different webapps
Date Thu, 02 Feb 2006 10:06:40 GMT
> From: Roel De Nijs [] 
> I have a tomcat with ± 10 web-applications. Is there a 
> maximum or some guidance in the number of web-apps you can 
> put in one instance of Tomcat?

Tomcat itself uses relatively little memory per-webapp (a few megabytes, depending on version).
 The major load comes from the number of simultaneous connections (and hence the size of the
thread pool) and, even more, from how the webapps are written.  You're in the best place to
evaluate these.

> And i start tomcat with the options -Xmx1024m -Xms1024m --> 
> is there some information or articles about how tomcat is 
> spreading all this memory over the web-apps? Is this 
> completely random, or first come first gets? What if a 
> web-app is called for the first time and all possible memory 
> is allocated to other web-apps?

It's all one big object memory, shared between all the webapps.  Roughly (there are many more
nuances than this): whenever it gets full, the garbage-collector is run.  If there's not enough
space to allocate an object after the garbage collector has run, you get an OutOfMemoryError.
 So memory will be allocated as your webapps request it (and potentially returned to the Java
VM's pool of free memory some unknown time after they stop using it); if a webapp is called
for the first time and there's not enough space to allocate the memory required for its startup,
you'll get an OOME.

To my knowledge, there is no way of partitioning memory inside a single JVM such that the
amount available to a given webapp can be restricted.

		- Peter

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

View raw message