You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by B....@pepperone.be on 2009/07/29 10:58:14 UTC
Tomcat High CPU consommation
Hello,
We have sometimes Tomcat (5.x) who consume all the CPU (or 50 %) of the
CPU constantly in our productions servers (Linux or Windows).
Our applications aren't doing anything and the only solution is to
restart Tomcat.
I don't know if the problem is related to Tomcat or to the JVM (Sun) but
I suspect that can occur when all the physical memory of the server is
used.
However, we set heap (between 1GO and 2GO) like this: Xmx = Xms <
[physical memory available] when the server starts, so Tomcat shouldn't
have disk swapping problem. (Am I wrong?) But other services can eat the
memory and the server can begin to swap...
Does anyone has had a problem like this?
Thank you.
Benjamin
Re: Tomcat High CPU consommation
Posted by Leon Rosenberg <ro...@googlemail.com>.
Hello Benjamin,
This sounds like an infinite loop - a bug in your application. This can happen
if you don't use synchronization properly, for example write and read
to/from Hashmap without synchronization from 2 parallel threads.
When you detect this behaviour again, create a full thread dump by
sending QUIT signal to the process:
kill -QUIT pid
tomcat will print out the thread dump into catalina.out. Look for
suspicious threads or just send it to the list again.
Btw, which tomcat version do you use exactly?
regards
Leon
On Wed, Jul 29, 2009 at 10:58 AM, <B....@pepperone.be> wrote:
> Hello,
>
>
>
> We have sometimes Tomcat (5.x) who consume all the CPU (or 50 %) of the
> CPU constantly in our productions servers (Linux or Windows).
>
> Our applications aren't doing anything and the only solution is to
> restart Tomcat.
>
> I don't know if the problem is related to Tomcat or to the JVM (Sun) but
> I suspect that can occur when all the physical memory of the server is
> used.
>
> However, we set heap (between 1GO and 2GO) like this: Xmx = Xms <
> [physical memory available] when the server starts, so Tomcat shouldn't
> have disk swapping problem. (Am I wrong?) But other services can eat the
> memory and the server can begin to swap...
>
> Does anyone has had a problem like this?
>
> Thank you.
>
>
>
> Benjamin
>
>
>
>
>
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Tomcat High CPU consommation
Posted by Juha Laiho <Ju...@iki.fi>.
B.Henriet@pepperone.be wrote:
> We have sometimes Tomcat (5.x) who consume all the CPU (or 50 %) of the
> CPU constantly in our productions servers (Linux or Windows).
Adding to the thread dump mentioned by Leon, on Linux you can run
"ps -fLp <tomcat_pid>"
to see CPU time usage per thread. Running this twice in a row
(with f.ex. 10 second interval) should show you which of the
threads is consuming the CPU (supposing it's just a single thread).
Combining this with the stack dumps form "kill -QUIT" should
help you pinpoint the bad thread.
> Our applications aren't doing anything and the only solution is to
> restart Tomcat.
That sounds like a deadlock of some kind (or it could also be JVM
memory exhaustion, in which case you should see the garbage collector
thread as the one taking up the CPU). Both could well be caused by
the code you run on Tomcat.
> However, we set heap (between 1GO and 2GO) like this: Xmx = Xms <
> [physical memory available] when the server starts, so Tomcat shouldn't
> have disk swapping problem. (Am I wrong?) But other services can eat the
> memory and the server can begin to swap...
Regardless of Xms/Xmx the OS could well choose to page parts of
the Java process to disk, if there's OS level memory shortage.
By setting Xms and Xmx equal you simplify the JVM internal memory
management (no need to run the logic do decide whether the overall
memory allocation should be increased or decreased, and apparently
a number of other memory handling checks, too). So, with this
configuration there's just one, fixed, memory allocation limit for
JVM.
--
..Juha
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org