You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Sai Bobba <bo...@gmail.com> on 2007/11/05 02:25:46 UTC

Tomcat causing high CPU load

Hi,

I'm using the following:

JDK1.5
Tomcat 6
SQL Server 2000
Server running on Windows 2000

The web app deployed consists of: an application form filled in by the
prospective student, a servlet that gets the form parameters
(>60), processes them, and saves the data input by the user to several
tables in the database.  Processing of the form data involves applying
testing the data against admission criteria.
When the web ap was first deployed some months ago, we had the problem that
some of the input by the users was too large for the space allocated in the
corresponding column in the db table - this caused SQLExceptions to be
thrown each time this happened. At the same time we noticed that many times
a day the CPU load on the server machine was up at 60% - 90+% - Tomcat was
responsible for this CPU load almost exclusively - the other processes
running on the machine were taking <3%. This meant having to restart Tomcat
several times a day. At first we thought this was related to the db
insertion problem. We fixed the db issue so that no more exceptions are
thrown, but we still find the CPU load up at >60% at least once a day -
Tomcat responsible again.
Another thing I noticed in testing the app was that if after I submitted an
application I hit the 'Back' button on the browser and then submitted again,
app would hang, and the CPU load on the server machine would rise to >60%. I
tried this several times, with the same result each time. However, it was
possible to submit an aplication from a different browser even when the CPU
load was high. Oddly, when I did this test on my local machine I didn't have
this problem.
I hope I've laid out the situation clearly. My searches on the web for this
sort of problem have yielded no solution.
If anybody has had this problem and fixed it, or has an insight into what
the problem might be, I'd greatly appreciate hearing about it!

Many thanks!

bob

Re: Tomcat causing high CPU load

Posted by Leon Rosenberg <ro...@googlemail.com>.
On 11/6/07, Peng Tuck Kwok <pe...@gmail.com> wrote:
> Is there a link for Moskito?

http://moskito.anotheria.net
http://moskito.dev.java.net

the site is on the move (moving to something better desgined) so just ask :-)

Leon

>
> On Nov 6, 2007 6:21 AM, Leon Rosenberg <ro...@googlemail.com> wrote:
> > Moskito can display monitoring traces instantly (path through
> > monitoring points) and measure time in each call and sub-calls, but it
> > requires some source code adoption.
> >
> > regards
> > Leon
> >
> >
> > On 11/5/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > > > From: Caldarale, Charles R
> > > > Subject: RE: Tomcat causing high CPU load
> > > >
> > > > There are also some 3rd-party tools to take thread dumps of
> > > > services (I think JProbe does, for example).
> > >
> > > Also, Lambda Probe (www.lambdaprobe.org) can display stack traces, but
> > > only one thread at a time.
> > >
> > >  - Chuck
> > >
> > >
> > > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> > > MATERIAL and is thus for use only by the intended recipient. If you
> > > received this in error, please contact the sender and delete the e-mail
> > > and its attachments from all computers.
> > >
> > > ---------------------------------------------------------------------
> > > 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
> > >
> > >
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Peng Tuck Kwok <pe...@gmail.com>.
Is there a link for Moskito?

On Nov 6, 2007 6:21 AM, Leon Rosenberg <ro...@googlemail.com> wrote:
> Moskito can display monitoring traces instantly (path through
> monitoring points) and measure time in each call and sub-calls, but it
> requires some source code adoption.
>
> regards
> Leon
>
>
> On 11/5/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > > From: Caldarale, Charles R
> > > Subject: RE: Tomcat causing high CPU load
> > >
> > > There are also some 3rd-party tools to take thread dumps of
> > > services (I think JProbe does, for example).
> >
> > Also, Lambda Probe (www.lambdaprobe.org) can display stack traces, but
> > only one thread at a time.
> >
> >  - Chuck
> >
> >
> > THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> > MATERIAL and is thus for use only by the intended recipient. If you
> > received this in error, please contact the sender and delete the e-mail
> > and its attachments from all computers.
> >
> > ---------------------------------------------------------------------
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Leon Rosenberg <ro...@googlemail.com>.
Moskito can display monitoring traces instantly (path through
monitoring points) and measure time in each call and sub-calls, but it
requires some source code adoption.

regards
Leon

On 11/5/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
> > From: Caldarale, Charles R
> > Subject: RE: Tomcat causing high CPU load
> >
> > There are also some 3rd-party tools to take thread dumps of
> > services (I think JProbe does, for example).
>
> Also, Lambda Probe (www.lambdaprobe.org) can display stack traces, but
> only one thread at a time.
>
>  - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> 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
>
>

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R 
> Subject: RE: Tomcat causing high CPU load
> 
> There are also some 3rd-party tools to take thread dumps of 
> services (I think JProbe does, for example).

Also, Lambda Probe (www.lambdaprobe.org) can display stack traces, but
only one thread at a time.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Sai Bobba [mailto:bobcatriaz@gmail.com] 
> Subject: Re: Tomcat causing high CPU load
> 
> I've searched the web for taking thread dumps

Try searching the Tomcat mailing list archives
(http://marc.info/?l=tomcat-user) as well.

For Windows, run the process from a command prompt, and enter a
CTRL-break when you see the problem.  If you're running it as a service,
get the PID number from Task Manager and use it with the jstack.exe
program.  (Not sure if jstack is available with JDK 1.5, but it is
included in JDK 6.)  There are also some 3rd-party tools to take thread
dumps of services (I think JProbe does, for example).

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: [OT] Tomcat causing high CPU load

Posted by alvaro tovar <al...@gmail.com>.
the application qhere i work, also have a big charge for the memory, the
server have this parametres, and never this crased, i think that this force
to free memory, the memory no colapse, but some errors to extrange, i think
that free memory that is in use, and this cause problems, kill a sesion, or
remove a backing bean of sesion, i don.t know, this is the parametrer

JAVA_OPTS="$JAVA_OPTS -Xms1500M -Xmx2000m -XX:MaxPermSize=1500m
-XX:+UseParallel
GC -XX:+AggressiveHeap -XX:+DisableExplicitGC -XX:NewRatio=2 -server"



On Nov 6, 2007 10:21 AM, Christopher Schultz <ch...@christopherschultz.net>
wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Charlie,
>
> Charlie Wingate wrote:
> > There is a kill.exe (older version in resource kits) and a newer
> > taskkill.exe included with XP [onward]
>
> Note that taskkill.exe and UNIX kill are completely different. taskkill
> actually kills tasks, while the UNIX kill sends signals to processes.
>
> > but neither of them will provide a
> > stack dump/trace.
>
> That is because of the lack of signaling ability of taskkill.exe.
>
> > Although they are very useful as tools and "parts".
>
> Definitely. I had no idea this program existed. My experience with MS
> Windows is that programs kill themselves frequently enough that I
> probably will continue to never need this tool ;)
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHMIZp9CaO5/Lv0PARApJmAJ4p55P3qwyLtMmLDVlc6jyPayhQ2wCgh//n
> zSjOq8EFoYEqbQz9ZLqq0bE=
> =poDw
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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: [OT] Tomcat causing high CPU load

Posted by Andrew Miehs <an...@2sheds.de>.
On 08/11/2007, at 6:29 PM, Bob Riaz wrote:

> Thanks. StringBuilder seems to be the most popular suggestion! I'm  
> going to implement this and report on any changes I see in Tomcat's  
> behavior.
> I'm also looking at other possiblities, such as Tomcat's I/O  
> activities causing thrashing if I/O is excessive. Would anybody know  
> how I could monitor Tomcat's I/O activities?
> Also, is there a way to configure Tomcat so that a connection times  
> out after a certain period of time?
> Thanks to everyone for your attention and help.
>
> Bob


Hi Bob,

You should really have a look at

http://tomcat.apache.org/tomcat-6.0-doc/config/http.html

I will leave how to configure the timeout as an exercise for the  
reader. :-)

Regards


Andrew

RE: [OT] Tomcat causing high CPU load

Posted by Bob Riaz <br...@mum.edu>.
Thanks. StringBuilder seems to be the most popular suggestion! I'm going to implement this and report on any changes I see in Tomcat's behavior. 
I'm also looking at other possiblities, such as Tomcat's I/O activities causing thrashing if I/O is excessive. Would anybody know how I could monitor Tomcat's I/O activities? 
Also, is there a way to configure Tomcat so that a connection times out after a certain period of time?
Thanks to everyone for your attention and help.

Bob 

-----Original Message-----
From: Kev Jackson [mailto:foamdino@gmail.com]
Sent: Wednesday, November 07, 2007 11:14 PM
To: Tomcat Users List
Subject: Re: [OT] Tomcat causing high CPU load


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




---------------------------------------------------------------------
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: [OT] Tomcat causing high CPU load

Posted by Kev Jackson <fo...@gmail.com>.
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


RE: [OT] Tomcat causing high CPU load

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: David kerber [mailto:dckerber@verizon.net] 
> Subject: Re: [OT] Tomcat causing high CPU load
> 
> Instead of using a string, use a StringBuffer and
> .append() to it

Or, if you're on Java 1.5 or 1.6, use a StringBuilder object; it's the
same as StringBuffer but without the synchronization overhead.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: [OT] Tomcat causing high CPU load

Posted by David kerber <dc...@verizon.net>.
Bob Riaz wrote:
> 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.
>   
Instead of using a string, use a StringBuffer and .append() to it, then 
when done building, the final string is just StringBuffer.toString();  
It's much faster than appending directly to a string.


> 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!
>
> bob
>
> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Tuesday, November 06, 2007 9:21 AM
> To: Tomcat Users List
> Subject: Re: [OT] Tomcat causing high CPU load
>
>
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Charlie,
>
> Charlie Wingate wrote:
>   
>> There is a kill.exe (older version in resource kits) and a newer
>> taskkill.exe included with XP [onward]
>>     
>
> Note that taskkill.exe and UNIX kill are completely different. taskkill
> actually kills tasks, while the UNIX kill sends signals to processes.
>
>   
>> but neither of them will provide a
>> stack dump/trace.
>>     
>
> That is because of the lack of signaling ability of taskkill.exe.
>
>   
>> Although they are very useful as tools and "parts".
>>     
>
> Definitely. I had no idea this program existed. My experience with MS
> Windows is that programs kill themselves frequently enough that I
> probably will continue to never need this tool ;)
>
> - -chris
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.7 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFHMIZp9CaO5/Lv0PARApJmAJ4p55P3qwyLtMmLDVlc6jyPayhQ2wCgh//n
> zSjOq8EFoYEqbQz9ZLqq0bE=
> =poDw
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> 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
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
>
>   



---------------------------------------------------------------------
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: [OT] Tomcat causing high CPU load

Posted by Bob Riaz <br...@mum.edu>.
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!

bob

-----Original Message-----
From: Christopher Schultz [mailto:chris@christopherschultz.net]
Sent: Tuesday, November 06, 2007 9:21 AM
To: Tomcat Users List
Subject: Re: [OT] Tomcat causing high CPU load


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie,

Charlie Wingate wrote:
> There is a kill.exe (older version in resource kits) and a newer
> taskkill.exe included with XP [onward]

Note that taskkill.exe and UNIX kill are completely different. taskkill
actually kills tasks, while the UNIX kill sends signals to processes.

> but neither of them will provide a
> stack dump/trace.

That is because of the lack of signaling ability of taskkill.exe.

> Although they are very useful as tools and "parts".

Definitely. I had no idea this program existed. My experience with MS
Windows is that programs kill themselves frequently enough that I
probably will continue to never need this tool ;)

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHMIZp9CaO5/Lv0PARApJmAJ4p55P3qwyLtMmLDVlc6jyPayhQ2wCgh//n
zSjOq8EFoYEqbQz9ZLqq0bE=
=poDw
-----END PGP SIGNATURE-----

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



---------------------------------------------------------------------
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: [OT] Tomcat causing high CPU load

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Charlie,

Charlie Wingate wrote:
> There is a kill.exe (older version in resource kits) and a newer
> taskkill.exe included with XP [onward]

Note that taskkill.exe and UNIX kill are completely different. taskkill
actually kills tasks, while the UNIX kill sends signals to processes.

> but neither of them will provide a
> stack dump/trace.

That is because of the lack of signaling ability of taskkill.exe.

> Although they are very useful as tools and "parts".

Definitely. I had no idea this program existed. My experience with MS
Windows is that programs kill themselves frequently enough that I
probably will continue to never need this tool ;)

- -chris

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHMIZp9CaO5/Lv0PARApJmAJ4p55P3qwyLtMmLDVlc6jyPayhQ2wCgh//n
zSjOq8EFoYEqbQz9ZLqq0bE=
=poDw
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Charlie Wingate <cw...@valco-data.com>.
There is a kill.exe (older version in resource kits) and a newer
taskkill.exe included with XP on; but neither of them will provide a
stack dump/trace.  Although they are very useful as tools and "parts".
:)

~Charlie
 
 
The significant problems we have cannot be solved at the same level of
thinking with which we created them.
  - Albert Einstein

-----Original Message-----
From: Caldarale, Charles R [mailto:Chuck.Caldarale@unisys.com] 
Sent: Tuesday, November 06, 2007 9:28 AM
To: Tomcat Users List
Subject: RE: Tomcat causing high CPU load

> From: Andrew Miehs [mailto:andrew@2sheds.de] 
> Subject: Re: Tomcat causing high CPU load
> 
> Kill -3 <TOMCAT PID>
> ps auxwh

The OP is running on Windows...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

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




 
 
************************************************************************
************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals &
computer viruses.
************************************************************************
************






-----------------------------------------------------------
This message is a CONFIDENTIAL communication.  If you are not the intended recipient, please do not read, copy, or use it, and do not disclose it to others.  Please notify the sender of the delivery error by replying to this message, and then delete it from your system.  Thank you.
 
************************************************************************************
This footnote confirms that this email message has been scanned by
PineApp Mail-SeCure for the presence of malicious code, vandals & computer viruses.
************************************************************************************




---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Andrew Miehs [mailto:andrew@2sheds.de] 
> Subject: Re: Tomcat causing high CPU load
> 
> Kill -3 <TOMCAT PID>
> ps auxwh

The OP is running on Windows...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Andrew Miehs <an...@2sheds.de>.
Hi Bob,

Kill -3 <TOMCAT PID>

Will produce a stack trace in catalina.out

This problem is VERY most probably your code, and not tomcat, but a
stacktrace should show this.

ps auxwh

will also give you an indication, its probably just 1 thread pushing
you to such a high load.

As for "walking" through the code - don't forget this stuff is
multithreaded so its not so easy to walk through...

My bets are on an  unsynchronized HashMap.


Cheers

Andrew

On 05/11/2007, at 10:44 PM, Sai Bobba wrote:

> Many thanks. We've had several developers walk through the code to  
> try to
> catch the possibity that the app may be sitting in a loop in some
> situations. The code seems ok, and, as I indicated, we've never been  
> able to
> reproduce the situation. I've searched the web for taking thread  
> dumps, as I
> don't know how to do that, butg haven't been able to find anything.  
> Perhaps
> you could give me a pointer if you have the time.
> Thanks again for your attention.
>
> Bob
>


---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Sai Bobba <bo...@gmail.com>.
Many thanks. We've had several developers walk through the code to try to
catch the possibity that the app may be sitting in a loop in some
situations. The code seems ok, and, as I indicated, we've never been able to
reproduce the situation. I've searched the web for taking thread dumps, as I
don't know how to do that, butg haven't been able to find anything. Perhaps
you could give me a pointer if you have the time.
Thanks again for your attention.

Bob


On 11/4/07, Caldarale, Charles R <Ch...@unisys.com> wrote:
>
> > From: Sai Bobba [mailto:bobcatriaz@gmail.com]
> > Subject: Tomcat causing high CPU load
> >
> > - Tomcat was responsible for this CPU
> > load almost exclusively
>
> You need to differentiate between Tomcat and the webapps running within,
> even though they are all running in the same process.  It is highly
> likely that it's your webapp stuck in a loop, not Tomcat itself.  As a
> first step, take several thread dumps when this high CPU usage is
> observed, and see where the threads are spending their time.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e-mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> 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: Tomcat causing high CPU load

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Sai Bobba [mailto:bobcatriaz@gmail.com] 
> Subject: Tomcat causing high CPU load
> 
> - Tomcat was responsible for this CPU 
> load almost exclusively

You need to differentiate between Tomcat and the webapps running within,
even though they are all running in the same process.  It is highly
likely that it's your webapp stuck in a loop, not Tomcat itself.  As a
first step, take several thread dumps when this high CPU usage is
observed, and see where the threads are spending their time.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
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: Tomcat causing high CPU load

Posted by Martin Gainty <mg...@hotmail.com>.
what happens in jconsole over that period of time?
M-
----- Original Message -----
From: "Sai Bobba" <bo...@gmail.com>
To: <us...@tomcat.apache.org>
Sent: Sunday, November 04, 2007 8:25 PM
Subject: Tomcat causing high CPU load


> Hi,
>
> I'm using the following:
>
> JDK1.5
> Tomcat 6
> SQL Server 2000
> Server running on Windows 2000
>
> The web app deployed consists of: an application form filled in by the
> prospective student, a servlet that gets the form parameters
> (>60), processes them, and saves the data input by the user to several
> tables in the database.  Processing of the form data involves applying
> testing the data against admission criteria.
> When the web ap was first deployed some months ago, we had the problem
that
> some of the input by the users was too large for the space allocated in
the
> corresponding column in the db table - this caused SQLExceptions to be
> thrown each time this happened. At the same time we noticed that many
times
> a day the CPU load on the server machine was up at 60% - 90+% - Tomcat was
> responsible for this CPU load almost exclusively - the other processes
> running on the machine were taking <3%. This meant having to restart
Tomcat
> several times a day. At first we thought this was related to the db
> insertion problem. We fixed the db issue so that no more exceptions are
> thrown, but we still find the CPU load up at >60% at least once a day -
> Tomcat responsible again.
> Another thing I noticed in testing the app was that if after I submitted
an
> application I hit the 'Back' button on the browser and then submitted
again,
> app would hang, and the CPU load on the server machine would rise to >60%.
I
> tried this several times, with the same result each time. However, it was
> possible to submit an aplication from a different browser even when the
CPU
> load was high. Oddly, when I did this test on my local machine I didn't
have
> this problem.
> I hope I've laid out the situation clearly. My searches on the web for
this
> sort of problem have yielded no solution.
> If anybody has had this problem and fixed it, or has an insight into what
> the problem might be, I'd greatly appreciate hearing about it!
>
> Many thanks!
>
> bob
>


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