You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Haase, Johannes | SCARUS" <j....@scarus.de> on 2009/03/31 15:56:08 UTC
Profiling tomcat applications with -Xrunhprof (Tomcat runs as a Windows
Service)
Hi folks!
We have a web application that runs on tomcat 5.5. It`s an productive
envrionment.
Tomcat 5.5 is installed as a Service on a Windows Server 2003.
I have started the tomcat with the java option
"-Xrunhprof:heap=sites,depth=10,file=C:\hprof.txt".
These settings I have done by the tomcat configuration gui (tomcat5w.exe).
The file in C:\hprof.txt was already created after starting the service.
However no further information except the general infos were written. I
cannot force the tomcat to dump the trace file.
If you stop as usual the service (with the services in the control
settings) no file is created.
If you kill the process via the task manager no file is created.
I have read that you can force to write that information if you`d start
the tomcat via console
and afterwards kill the tomcat via CTRL+C.
Unfortunately my environment doesn`t use this configuration for tomcat 5.5.
The environment is an productive one.
Many thanks for help in advanced.
Appreciated!
Johannes
Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs as
a Windows Service)
Posted by "Haase, Johannes | SCARUS" <j....@scarus.de>.
Christopher Schultz schrieb:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Johannes,
>
> On 3/31/2009 9:56 AM, Haase, Johannes | SCARUS wrote:
>
>> "-Xrunhprof:heap=sites,depth=10,file=C:\hprof.txt".
>>
>
> [snip]
>
>
>> However no further information except the general infos were written. I
>> cannot force the tomcat to dump the trace file.
>>
>
> Are you trying to get profiling data, or are you trying to get a thread
> dump?
>
Profiling data (-Xrunhprof:*heap*=sites, ...)
>
>> I have read that you can force to write that information if you`d start
>> the tomcat via console
>> and afterwards kill the tomcat via CTRL+C.
>>
>
> I think you're describing the process to get a thread dump (which is
> CTRL-\, /not/ CTRL-C, which will kill your process).
>
> Which JVM are you using? When I run "java -Xrunhprof:help" from my Sun
> 1.5.0 install (on Linux), it says I should be using -agentlib:hprof and
> that the "Xrunhprof interface" will be removed in future versions.
> Perhaps your version has Xrunhprof removed and using agentlib:hprof will
> work. Try playing with this on the command-line to see what is available
> at your JVM level.
>
What is a thread dump? I need the heap profiling information. Especially
how many object are created
of a special class.
CRTL+C ... ??? I do not know exactly the combination of that shortcut.
Generally, I don`t have any
console because there is just a windows service that has started the tomcat.
My java -version is 1.5.0.
I have also used the agentlib option. There ist no difference.
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
>
> iEYEARECAAYFAknSL1kACgkQ9CaO5/Lv0PCZywCggr5nQCkJ9Qq4fxV8yd1IYpbn
> yBEAnRMYBNTzFPyYpnGIJWuLRMf3poVU
> =pSVX
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs asa
Windows Service)
Posted by Gregor Schneider <rc...@googlemail.com>.
On Tue, Mar 31, 2009 at 5:19 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
>> From: Christopher Schultz [mailto:chris@christopherschultz.net]
>> Subject: Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs
>> asa Windows Service)
>>
>> Are you trying to get profiling data, or are you trying
>> to get a thread dump?
>
> No, he's looking for heap profiling.
>
>> I think you're describing the process to get a thread dump (which is
>> CTRL-\, /not/ CTRL-C, which will kill your process).
>
Talking about thread-dumps:
I guess Johannes is using a German keyboard. On a German keyboard, a
Java-thread-dump is triggered by <Strg><Pause>
(That's <CTRL><BREAK> translated).
HTH
Gregor
--
just because your paranoid, doesn't mean they're not after you...
gpgp-fp: 79A84FA526807026795E4209D3B3FE028B3170B2
gpgp-key available
@ http://pgpkeys.pca.dfn.de:11371
@ http://pgp.mit.edu:11371/
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
RE: Profiling tomcat applications with -Xrunhprof (Tomcat runs asa
Windows Service)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Subject: Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs
> asa Windows Service)
>
> Are you trying to get profiling data, or are you trying
> to get a thread dump?
No, he's looking for heap profiling.
> I think you're describing the process to get a thread dump (which is
> CTRL-\, /not/ CTRL-C, which will kill your process).
No, CTRL-C will terminate the process, and get the hprof data, when started from a command prompt.
> Which JVM are you using? When I run "java -Xrunhprof:help" from my Sun
> 1.5.0 install (on Linux), it says I should be using -agentlib:hprof and
> that the "Xrunhprof interface" will be removed in future versions.
Which it's been saying for quite some time. Like many other deprecated interfaces, the - Xrunhprof will be there for a while; it still works in 1.7.
> Perhaps your version has Xrunhprof removed and using agentlib:hprof
> will work.
The -Xrunhprof is clearly being recognized, since the C:\hprof.txt file is being created. (And the profiling is definitely occurring - performance is terrible with it on.) Changing it to the newer -agentlib format doesn't make any difference; JVM initialization translates the old -Xrunhprof syntax to the newer JVMTI format internally. In neither case does the hprof file get written, other than the few lines of header.
What might work is using JVisualVM instead and just looking at the information in the GUI.
- 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.
RE: Profiling tomcat applications with -Xrunhprof (Tomcat runs asa
Windows Service)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Haase, Johannes | SCARUS [mailto:j.haase@scarus.de]
> Subject: Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs
> asa Windows Service)
>
> How can I start the tomcat 5.5 that was installed and intended
> to run as a service via console?
Look in Tomcat's bin directory; if you have startup.bat and shutdown.bat scripts, use those. If you don't have them, download the .zip package of Tomcat, expand it, and copy all the bin/*.bat files into your existing bin directory. (The .exe package omits the scripts, for inexplicable reasons.)
Once that's done, open up a command prompt window, set JAVA_HOME to your JDK location (or JRE_HOME to your JRE), set CATALINA_OPTS to whatever JVM command-line parameters you need, and run startup.bat. Note that none of your config settings from tomcat5w.exe are used automatically; you have to supply them via CATALINA_OPTS, including heap sizes. The Tomcat process will start in a separate window. Use shutdown.bat from the original commmand prompt window to terminate it.
- 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.
Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs asa
Windows Service)
Posted by "Haase, Johannes | SCARUS" <j....@scarus.de>.
Caldarale, Charles R schrieb:
>> From: Caldarale, Charles R
>> Subject: RE: Profiling tomcat applications with -Xrunhprof (Tomcat runs
>> asa Windows Service)
>>
>> What might work is using JVisualVM instead and just looking at the
>> information in the GUI.
>>
>
> I did get JVisualVM to work with Tomcat running as a service, but I don't think you're going to like it (to paraphrase Douglas Adams).
>
> First, the Tomcat service needs to be running under the same Windows account that JVisualVM is started with; JVisualVM cannot find the PID otherwise, and heap profiling doesn't seem to be available through JMX ports (or maybe I just don't know how to configure it).
>
> Second, you'll need to run Tomcat under JRE/JDK 1.6. JVisualVM can access Tomcat running under a 1.5 JRE, but heap profiling won't be available.
>
> So, the easiest thing may well be to just run Tomcat from the command prompt for the duration of the profiling effort. Since heap profiling has a significant performance impact, you wouldn't want it on very long anyhow.
>
> - Chuck
>
Hello Chuck!
Thanks for clarification.
How can I start the tomcat 5.5 that was installed and intended to run as
a service via console?
Thanks a lot!
Johannes
>
> 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.
>
>
--
Johannes Haase
SCARUS GmbH & Co. KG
E3, 13
68159 Mannheim
Tel.: +49-(0)621-761926-11
Fax: +49-(0)621-761926-59
Mobile: +49-(0)151-56314777
www.scarus.de <http://www.scarus.de/>
USt.-ID DE 237062963 * Amtsgericht Ludwigshafen HRA 3884
Geschäftsführer: Matthias Ulrich & Christoph Kurek
Diese E-Mail kann Betriebs- oder Geschäftsgeheimnisse oder sonstige
vertrauliche Informationen enthalten. Sollten Sie diese E-Mail
irrtümlich erhalten haben, ist Ihnen eine Kenntnisnahme des Inhalts,
eine Vervielfältigung oder Weitergabe ausdrücklich untersagt. Bitte
benachrichtigen Sie uns und vernichten Sie die empfangene E-Mail. Vielen
Dank.
This e-mail may contain trade secrets or privileged, undisclosed or
otherwise confidential information. If you have received this e-mail in
error, you are hereby notified that any review, copying or distribution
of it is strictly prohibited. Please inform us immediately and destroy
the original transmittal. Thank you for your cooperation.
RE: Profiling tomcat applications with -Xrunhprof (Tomcat runs asa
Windows Service)
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Caldarale, Charles R
> Subject: RE: Profiling tomcat applications with -Xrunhprof (Tomcat runs
> asa Windows Service)
>
> What might work is using JVisualVM instead and just looking at the
> information in the GUI.
I did get JVisualVM to work with Tomcat running as a service, but I don't think you're going to like it (to paraphrase Douglas Adams).
First, the Tomcat service needs to be running under the same Windows account that JVisualVM is started with; JVisualVM cannot find the PID otherwise, and heap profiling doesn't seem to be available through JMX ports (or maybe I just don't know how to configure it).
Second, you'll need to run Tomcat under JRE/JDK 1.6. JVisualVM can access Tomcat running under a 1.5 JRE, but heap profiling won't be available.
So, the easiest thing may well be to just run Tomcat from the command prompt for the duration of the profiling effort. Since heap profiling has a significant performance impact, you wouldn't want it on very long anyhow.
- 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.
Re: Profiling tomcat applications with -Xrunhprof (Tomcat runs as
a Windows Service)
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Johannes,
On 3/31/2009 9:56 AM, Haase, Johannes | SCARUS wrote:
> "-Xrunhprof:heap=sites,depth=10,file=C:\hprof.txt".
[snip]
> However no further information except the general infos were written. I
> cannot force the tomcat to dump the trace file.
Are you trying to get profiling data, or are you trying to get a thread
dump?
> I have read that you can force to write that information if you`d start
> the tomcat via console
> and afterwards kill the tomcat via CTRL+C.
I think you're describing the process to get a thread dump (which is
CTRL-\, /not/ CTRL-C, which will kill your process).
Which JVM are you using? When I run "java -Xrunhprof:help" from my Sun
1.5.0 install (on Linux), it says I should be using -agentlib:hprof and
that the "Xrunhprof interface" will be removed in future versions.
Perhaps your version has Xrunhprof removed and using agentlib:hprof will
work. Try playing with this on the command-line to see what is available
at your JVM level.
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/
iEYEARECAAYFAknSL1kACgkQ9CaO5/Lv0PCZywCggr5nQCkJ9Qq4fxV8yd1IYpbn
yBEAnRMYBNTzFPyYpnGIJWuLRMf3poVU
=pSVX
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org