You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by paul womack <pw...@papermule.co.uk> on 2007/06/13 14:35:46 UTC

role of threads - profiling?

I'm just trying to do some simple profiling
on an app running under tomcat 4.

I've enabled profiling using:
JAVA_OPTS="-Xrunhprof:cpu=samples,depth=40,thread=y"; export JAVA_OPTS
and am successfully getting a java.hprof.txt file
when tomcat is stopped. (after a 70 second
run, with a perl script hammering away
via http)

On analysing the file with jperfanal
http://jperfanal.sourceforge.net/JPerfAnal_manual.html

I was intially completely confused.

Then I realised than tomcat
is (to say the least) multi-threaded,
and went to use the tool's thread analyses.

In terms of recorded "ticks", the most important
thread is "main", with 9666 ticks, closely
followed by:

TP-processor4 (9470 ticks)

After this I get a list of
http10722-processor<N> threads, with ticks
running down from 4580 -> 487

all other threads have very few "ticks".

On examining function profiles for these threads,
it is clear that the http threads are actually "my application"
doing useful (IMHO) work.

Can anyone outline to me what the main() and TP-processor
threads are doing?

I'd be happy to be pointed at relevant doc, but I've searched
and read stuff for the last hour without really moving
forward in my understanding.

    BugBear


---------------------------------------------------------------------
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: role of threads - profiling?

Posted by David Delbecq <de...@oma.be>.
En l'instant précis du 13/06/07 14:35, paul womack s'exprimait en ces
termes:
> I'm just trying to do some simple profiling
> on an app running under tomcat 4.
>
> I've enabled profiling using:
> JAVA_OPTS="-Xrunhprof:cpu=samples,depth=40,thread=y"; export JAVA_OPTS
> and am successfully getting a java.hprof.txt file
> when tomcat is stopped. (after a 70 second
> run, with a perl script hammering away
> via http)
>
> On analysing the file with jperfanal
> http://jperfanal.sourceforge.net/JPerfAnal_manual.html
>
> I was intially completely confused.
>
> Then I realised than tomcat
> is (to say the least) multi-threaded,
> and went to use the tool's thread analyses.
>
> In terms of recorded "ticks", the most important
> thread is "main", with 9666 ticks, closely
The main thread is the startup tomcat thread. It does various stuff
like, i think, responding to shutdown hook, and, most important,
starting up your application. It has lots of ticks because the startup
of your tomcat is what took you the most time. You should hammer your
applicaiton during more than 70 second to have a correct behaviour of
cpu usage. initialization stuff from main takes a bit of time (from a
few seconds for empty tomcat to 1 or 2 minutes with big applications)
but occurs only once per life of jvm.

> followed by:
>
> TP-processor4 (9470 ticks)
>
I think they handle various connections of tomcat before dispatching
them to http-thread, modjk thread or alike. But not sure.
> After this I get a list of
> http10722-processor<N> threads, with ticks
> running down from 4580 -> 487
>
> all other threads have very few "ticks".
>
> On examining function profiles for these threads,
> it is clear that the http threads are actually "my application"
> doing useful (IMHO) work.
yes, it's the work of application responding to request + time spend by
tomcat to parse request and direct it to correct webapplication
>
> Can anyone outline to me what the main() and TP-processor
> threads are doing?
>
> I'd be happy to be pointed at relevant doc, but I've searched
> and read stuff for the last hour without really moving
> forward in my understanding.
>
>    BugBear
>
>
> ---------------------------------------------------------------------
> 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