tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kev Jackson <foamd...@gmail.com>
Subject Re: [OT] Tomcat causing high CPU load
Date Thu, 08 Nov 2007 05:13:54 GMT
Hi,
 From a programmatic point of view


> Many thanks for all the suggestions. I found a simple tool called StackTrace from http://www.adaptj.com/root/main/tracehowtos#ht0
to help me take thread dumps from Tomcat. I found when the CPU load was high that there was
a thread from the suspect web app running. In contrast, thread dumps taken when CPU load was
normal showed no such threads. The line that the web app thread was running at is a simple
- data += "\n"; - this is in a loop collecting form data from hidden vars created by JavaScript
code. It's been suggested by ny colleagues that the JVM could be running out of memory since
a new String object is created for each +=. The String data ends up being very long anyway.
Any thoughts on this would be appreciated.
> Also, would anyone know how to monitor Tomcat's I/O activities? I understand that thrashing
could be a drain on memory resources.
> Thanks again for everybody's help!

You could replace the data += "\n" code with a StringBuilder (Java6) or 
a StringBuffer - this would reduce the number of intermediate objects 
being created quite significantly

Kev

---------------------------------------------------------------------
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


Mime
View raw message