Quantcast

100% CPU by java process in Tomcat

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

100% CPU by java process in Tomcat

Phani Raj Kumar
Hi friends,

When i tried to run tomcat server with a web application in it, it is taking
100% cpu on application initialization. It seems system is allocating 100%
of  CPU time for this java process.Could you please throw some light on
this.

Thanks,
Phani.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 100% CPU by java process in Tomcat

Peter Crowther
Tomcat version?
OS?
JDK version?
Any errors or messages in the logs?
If you take a thread dump (the method varies depending on OS and JDK
version), what's running?

- Peter

2009/8/20 Phani Raj Kumar <[hidden email]>

> Hi friends,
>
> When i tried to run tomcat server with a web application in it, it is
> taking
> 100% cpu on application initialization. It seems system is allocating 100%
> of  CPU time for this java process.Could you please throw some light on
> this.
>
> Thanks,
> Phani.
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 100% CPU by java process in Tomcat

Phani Raj Kumar
Thanks peter,

Here is the info:
*JDK version* : j2sdk1.4.2_11
*Tomcat Version*: jakarta-tomcat-5.0.28
*OS*: SunOS burton 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V440
*CATALINA_OPTS*="-Xms64m -Xmx256m"

I didn't get any error messages in the log, but even running the tomcat
alone without any applications in it taking 100% cpu.

Thanks for your prompt respone.

-Phani.



On Thu, Aug 20, 2009 at 2:31 PM, Peter Crowther <[hidden email]
> wrote:

> Tomcat version?
> OS?
> JDK version?
> Any errors or messages in the logs?
> If you take a thread dump (the method varies depending on OS and JDK
> version), what's running?
>
> - Peter
>
> 2009/8/20 Phani Raj Kumar <[hidden email]>
>
> > Hi friends,
> >
> > When i tried to run tomcat server with a web application in it, it is
> > taking
> > 100% cpu on application initialization. It seems system is allocating
> 100%
> > of  CPU time for this java process.Could you please throw some light on
> > this.
> >
> > Thanks,
> > Phani.
> >
>
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 100% CPU by java process in Tomcat

Peter Crowther
2009/8/20 Phani Raj Kumar <[hidden email]>
> Here is the info:
> *JDK version* : j2sdk1.4.2_11

This is old, though that probably isn't the cause of this problem.  Do
you need to run this JDK, or can you upgrade?

> *Tomcat Version*: jakarta-tomcat-5.0.28

This is no longer supported, though that probably isn't the cause of
the problem.  Do you need to run this version, or can you upgrade?

> *OS*: SunOS burton 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V440
> *CATALINA_OPTS*="-Xms64m -Xmx256m"
>
> I didn't get any error messages in the log, but even running the tomcat
> alone without any applications in it taking 100% cpu.

OK, that's interesting.  Something odd is happening!

The next step is to take a thread dump and find out what's running.
Use ps to find the process ID of the Java process that's running
Tomcat, then send it a SIGQUIT (kill -3 <pid>).  The thread dump
should appear in one of the log files, probably catalina.out (from
memory) unless you've changed the logging.

There will be several threads in the thread dump - some blocked, some
running.  If you post the thread dump here, we can take a look at it.
You will need to include it in your mail message, as the mailing list
software strips out attachments.

- Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Pid
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 100% CPU by java process in Tomcat

Pid
On 20/08/2009 10:24, Peter Crowther wrote:

> 2009/8/20 Phani Raj Kumar<[hidden email]>
>> Here is the info:
>> *JDK version* : j2sdk1.4.2_11
>
> This is old, though that probably isn't the cause of this problem.  Do
> you need to run this JDK, or can you upgrade?
>
>> *Tomcat Version*: jakarta-tomcat-5.0.28
>
> This is no longer supported, though that probably isn't the cause of
> the problem.  Do you need to run this version, or can you upgrade?
>
>> *OS*: SunOS burton 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V440
>> *CATALINA_OPTS*="-Xms64m -Xmx256m"

Does your app do a lot of work whilst starting up?
What is its actual memory usage when running?

Wait until the app has started up and had time to run under
normal/expected load conditions and then examine the heap sizes:

  jmap -heap <pid>

If the heap is above 64m, then try setting -Xms256m.

There's not much point in making the JVM (particularly an old one) doing
loads of work to increase it's heap size, when you can just set the max
you use, to start with - especially during startup.

p


>> I didn't get any error messages in the log, but even running the tomcat
>> alone without any applications in it taking 100% cpu.
>
> OK, that's interesting.  Something odd is happening!
>
> The next step is to take a thread dump and find out what's running.
> Use ps to find the process ID of the Java process that's running
> Tomcat, then send it a SIGQUIT (kill -3<pid>).  The thread dump
> should appear in one of the log files, probably catalina.out (from
> memory) unless you've changed the logging.
>
> There will be several threads in the thread dump - some blocked, some
> running.  If you post the thread dump here, we can take a look at it.
> You will need to include it in your mail message, as the mailing list
> software strips out attachments.
>
> - Peter
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: 100% CPU by java process in Tomcat

Juha Laiho
In reply to this post by Phani Raj Kumar
On Thu, 20 Aug 2009, Phani Raj Kumar wrote:

> Here is the info:
> *JDK version* : j2sdk1.4.2_11
> *Tomcat Version*: jakarta-tomcat-5.0.28
> *OS*: SunOS burton 5.8 Generic_117350-46 sun4u sparc SUNW,Sun-Fire-V440
> *CATALINA_OPTS*="-Xms64m -Xmx256m"
>
> I didn't get any error messages in the log, but even running the tomcat
> alone without any applications in it taking 100% cpu.

For how long did you wait for the CPU usage to drop?
Tomcat does, at startup, run for a while at almost 100% CPU usage - for
how long, depends largely on the speed of your machine.

If you haven't done so yet, you could try letting the Tomcat run for
something like five minutes; with that machine, I would expect the
CPU usage to return to near-zero in less than two minutes.

If the CPU usage is at 100% level still after the five minutes, you could
take a thread dump of the Java process (by sending a QUIT signal, with
"kill -QUIT tomcat_PID"), and looking at the per-thread CPU usage with
successive "ps -fLp tomcat_PID" commands, and then correlate the thread
ID from the thread dump with the thread you see with the "ps" outputs
as being the largest user of CPU time.
--
..Juha

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...