You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Reis, Tom" <re...@cod.edu> on 2008/10/03 21:29:23 UTC

CPU utilization and Tomcat 5.5.20

We are running Tomcat 5.5.20 with jvm 1.5.0_14. Tomcat utilization goes
to 100 percent being used by Tomcat. Any ideas why the utilization would
go so high. Thanks. 

Re: CPU utilization and Tomcat 5.5.20

Posted by Juha Laiho <Ju...@iki.fi>.
Reis, Tom wrote:
> We are running Tomcat 5.5.20 with jvm 1.5.0_14. Tomcat utilization goes
> to 100 percent being used by Tomcat. Any ideas why the utilization would
> go so high. Thanks. 

Please let us have more infromation.

Upon startup, it is typical of Tomcat to be very CPU-intensive for a while
(length of the time is of course dependent on the CPU power available
and application workload placed on the server).

Other than that, the JVM running Tomcat will be largely idle, unless it is
serving requests (with the exception of running the JVM to a memory
exhaustion state, in which case the JVM can pretty much sit in a loop
running garbage collection).


So, clarifying questions;
- are you referring to the 100% CPU usage right after startup
  (could take 10 seconds; could take a couple of minutes, depending
   on details)
- is your Tomcat JVM running at its allocated heap limit
- are there requests being served while the CPU is fully utilized
- are you seeing this on a Tomcat with none of your own applications
  installed, or on a Tomcat having your applications deployed

Depending on your OS platform, you might be able to look at CPU usage
in individual threads within the JVM, and combine this knowledge with
a thread dump from the Tomcat JVM instance, in order to see which are
the busy threads (GC thread, worker thread, something else), and also
to see at least a momentary stack dump of the busy thread (in other
words, you might be able to see what code is running in the busy
thread). You could also enable GC logging, to see whether there is
excess garbage collection activity within the JVM (which would indicate
either a memory leak or a too small JVM heap allocation).

My first two claims would be:
- it is caused by your application code (or libraries brought in with
  your application code)
- it could be that your application code (or libraries...) is running
  against the JVM memory limit, making it run garbage collection in
  an endless loop (and if you let it stay that way long enough, it'll
  crash with an OutOfMemoryError)

but I could just as well be wrong. It could also be some code in
Tomcat getting stuck in an endless loop. It's just that bugs seem
to be less common in Tomcat than in the typical webapps I see.
-- 
..Juha

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


Re: CPU utilization and Tomcat 5.5.20

Posted by Leon Rosenberg <ro...@googlemail.com>.
look at your applications inside of tomcat. make thread dumps.
Leon

On Fri, Oct 3, 2008 at 9:29 PM, Reis, Tom <re...@cod.edu> wrote:
> We are running Tomcat 5.5.20 with jvm 1.5.0_14. Tomcat utilization goes
> to 100 percent being used by Tomcat. Any ideas why the utilization would
> go so high. Thanks.
>

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


RE: CPU utilization and Tomcat 5.5.20

Posted by Martin Gainty <mg...@hotmail.com>.
yes pls follow leon's advice and compare your thread dumps so you can determine TC thread activity
and coordinate that to the webapp's resource activity

I would look at minHeap, maxHeap and stack parameters from %JAVA_OPTS%
a 2004 post http://forums.sun.com/thread.jspa?messageID=10055131 says it best



The default stack size is 256K on UNIX and on 32-bit Windows operating systems. To set Stack size

java -XX:NewSize=128m -XX:MaxNewSize=128m -XX:SurvivorRatio=8  -Xms512m -Xmx512m



1. Setting the New generation heap size

 -XX:NewSize
 Use
this option to set the New generation Java heap size. Set this value to
a multiple of 1024 that is greater than 1MB. As a general rule, set
-XX:NewSize to be one-fourth the size of the maximum heap size.
Increase the value of this option for larger numbers of short-lived
objects.



Be sure to increase the New generation as you increase the number of
processors. Memory allocation can be parallel, but garbage collection
is not parallel.

 

2. Setting the maximum New generation heap size

 -XX:MaxNewSize

Use this option to set the maximum New generation Java heap size. Set
this value to a multiple of 1024 that is greater than 1MB.

 

3. Setting New heap size ratios

 -XX:SurvivorRatio

 The New generation area is divided into three sub-areas: Eden, and two survivor spaces that are equal in size. 



Use the -XX:SurvivorRatio=X option to configure the ratio of the
Eden/survivor space size. Try setting this value to 8, and then monitor
your garbage collection.

 

4. Setting minimum heap size

 -Xms

Use this option to set the minimum size of the memory allocation pool.
Set this value to a multiple of 1024 that is greater than 1MB. As a
general rule, set minimum heap size (-Xms) equal to the maximum heap
size (-Xmx) to minimize garbage collections.

 

5. Setting maximum heap size

 -Xmx

 Use this option to set the maximum Java heap size. Set this value to a multiple of 1024 that is greater than 1MB.



 




    


    


pay attention to MaxHeap, MinHeap, StackSize and set your GC's to mark and sweep for discarded blocks

HTH
Martin Gainty 
______________________________________________ 
Disclaimer and confidentiality note 
Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. 


> Subject: CPU utilization and Tomcat 5.5.20
> Date: Fri, 3 Oct 2008 14:29:23 -0500
> From: reistom@cod.edu
> To: users@tomcat.apache.org
> 
> We are running Tomcat 5.5.20 with jvm 1.5.0_14. Tomcat utilization goes
> to 100 percent being used by Tomcat. Any ideas why the utilization would
> go so high. Thanks. 

_________________________________________________________________
Want to do more with Windows Live? Learn “10 hidden secrets” from Jamie.
http://windowslive.com/connect/post/jamiethomson.spaces.live.com-Blog-cns!550F681DAD532637!5295.entry?ocid=TXT_TAGLM_WL_domore_092008