Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using the Netbeans 6.5 profiler to profile a remote web app?

I'm having trouble using the Netbeans 6.5 profiler to profile the memory usage of a java web app, remotely.

I have followed the steps in the tutorial, and was able to customize a Tomcat instance to start with the profiling agents. I can also attach the Netbeans profiler to the running server: for some seconds, the profiler shows graphs with the memory usage of the server.

However, I am not able to run my deployed web app. After a few seconds, the server is shut down gracefully as if it simply had reached the bottom of its method main (hardly the expected behavior of a web server).

During these seconds, the server is not responsible, and I can't connect to a web application in it, they are simply not deployed.

I do not want to import my app into a new Netbeans project just for profiling it. It's possible to profile a remote app without access to its source, right ? After all, for a few seconds, the server was running and being profiled.

I want to profile a web application in Netbeans 6.5. What did I forget ?

like image 662
Leonel Avatar asked Nov 15 '22 16:11

Leonel


1 Answers

You can use VisualVM tool as well. Follow the below mentioned steps.

1) Run jstatd ( jstat demon process) ( Run on your remote machine where application is running) jstatd -p 1098 -J-Djava.security.policy=tools.policy ( specify unused port ) if tools.policy file is not specified create it as follows.

tools.policy 
grant codebase "file:${java.home}/../lib/tools.jar" {

permission java.security.AllPermission; };

2) Also specify the following properties before you start your JVM.

#JMX property
JVM_ARGS="${JVM_ARGS} -Dcom.sun.management.jmxremote=true"
JVM_ARGS="${JVM_ARGS} -Dcom.sun.management.jmxremote.port=10992"
JVM_ARGS="${JVM_ARGS} -Dcom.sun.management.jmxremote.authenticate=false"
JVM_ARGS="${JVM_ARGS} -Dcom.sun.management.jmxremote.ssl=false"

3) Start the visual VM on local machine. a. Under remote tab add remote node. b. Wait for couple of minutes you will see all the core applications instance will be seen under remote tab. c. Click on remote node then select Add JMX connections specify node:port (port mentioned above in point 2.) d. Wait for few seconds you will see JMX connection under remote node.

4) After few seconds you will see new tab appearing under remote node. Double click on the remote_node:10992 you will see the profile table on right hand side. You can see memory , cpu , thread etc details ..

like image 129
Shailesh Kushwaha Avatar answered Dec 20 '22 13:12

Shailesh Kushwaha