Article ID: 4177, created on Mar 24, 2008, last review on May 10, 2014

  • Applies to:
  • Sphera

Symptoms

TomCat is using too much resources on a server

Resolution

TomCat is a major consumer of resources on a server. This is why it is not recommended to create too many VDSs which use Tomcat on one server. The solution is to spread them on many servers. 

However, there are two ways to reduce the amount of resources tomcat's java resources use:

  1. Limit the number of Java threads.
  2. Limit the maximum Java heap size.

 

The number of threads already reduced to 5 (maxProcessors prarameter in etc/tomcat4/server.xml file).

Maximum heap size can be set with -Xmx option of java (-Xmx64m for example). This can be done in tomcat4.conf file for example. The problem with this limit is that user's application can get 'out of memory' error in case it needs more memory, than this limit.

Another point that is important to know : When you are checking the memory usage for java processes - all process of a java tree uses the same memory block, this is why all threads have same amount of memory. For example, if a 'parent' java process uses 120 Mb RAM, then all his N threads show that they use 120M, but the total usage of them all is 120 Mb, and not 120*N.

5f478287f7e74fe9b07217d8131cd741 6311ae17c1ee52b36e68aaf4ad066387

Email subscription for changes to this article
Save as PDF