tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Freitag <tho...@freit.ag>
Subject Re: Tomcat 7 Per Instance Memory Footprint in Hello World App.
Date Tue, 15 Mar 2011 09:09:36 GMT
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Noah,

On 14.03.11 um 21:27, Noah Cutler wrote:
> So, given that a running 32-bit JVM on Linux will require at least 1GB
> RAM, total memory usage will not be JVM footprint * num instances, but
> rather, JVM footprint + num instances?

Actually, the 1GB are virtual memory usage, not everything is
allocated in the physical memory. I'd say it is roughly: num instances * (JVM
not shareable + JVM heap&perm) + JVM shareable. JVM not shareable
could be around 200-300MB. What heap sizes do you expect?

The figures I gave for Tomcat were taken directly after
startup. Because Tomcat starts additional threads for the connector
thread pools these could increase (maybe 50MB instead of 5MB), and
request processing needs some memory.
 
> The use case is transferring 20 client sites from LAMP stack to JVM +
> Tomcat 7 + MySQL + a Groovy.lang web framework I developed.
> 
> Ideally I would separate client sites into tomcat instances, so as to
> isolate them from each other (i.e. redeploy/restart without affecting
> other instances), but that hinges entirely on the memory footprint.

You have to include the memory footprint of your applications into the
calculation. If you configure small heap sizes the risk of getting
OutOfMemoryErrors increases. If you deploy more than one application
in your tomcat instances, average usage of heap memory, threads and
database connections could be better.
 
> I have 16GB RAM available but was only planning on allocating 4-6GB RAM
> for this project. Only a couple of the sites in question do significant
> load (read: have been running on LAMP stack with 2GB RAM for several
> years without issue)

I'd try a mixed approach: Run some tomcat instances with more than one
application. Some restarts can be avoided by using hot deployments.
The MemoryLeakPreventionListener [1] helps to check if your applications
trigger some known memory leaks. That may fit your needs. 

I'm afraid it is very hard (or impossible) to start with an optimal
configuration. You will have to make an educated guess (usually
configure more ressources than necessary), monitor the resource usage, 
and adapt the configuration to your needs.

[1] http://tomcat.apache.org/tomcat-7.0-doc/config/listeners.html

Regards,
- -- 
Thomas Freitag
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAk1/LNAACgkQGE5pHr3PKuVkTwCeJLZkrBKq9yVkEmenQUV+ItkO
OcUAn3sznmYn/GTpbLospwQ30Kp7Ly/g
=+pCj
-----END PGP SIGNATURE-----

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


Mime
View raw message