FaqProfilerAttachRemoteServer

How do I attach Profiler to a remote server?

To attach the Profiler to a remote server instance you need to copy the Profiler libraries and files in the Remote Profiling Pack to the remote system and then modify the startup configuration files for the server to load the libraries when the server starts. Before you start profiling the remote application you also need to run the calibration script in the Remote Profiling Pack to ensure that the profiling data is accurate.

The configuration files that you need to modify will depend upon the target server. You can find details about how to configure the supported servers below.


Contents



Generating the Remote Profiling Pack

You can use the Attach Settings dialog in the IDE to generate a Remote Profiling Pack for the target server.

  1. Choose Profile > Attach Profiler from the main menu in the IDE to open the Attach Profiler dialog box.
  2. Click define in the Attach Profiler dialog box to open the Attach Settings dialog box.
  3. Select Remote as the Target.
  4. Specify the Hostname and OS & JVM details.
  5. In the text box of the dialog box, click create a Remote Profiling Pack in Step 2.
  6. Specify a location on your local system for the Remote Profiling Pack and click Save.

After you save the Remote Profiling Pack, extract the contents of the archive and copy the file to a location on the remote server.


Hint: When profiling CPU, you should set a meaningful instrumentation filter and/or select Part of Application option to reduce profiling overhead.

Configuring the Server

The following steps describe how to modify the startup scripts for various servers to load the profiler libraries in the Remote Profiling Pack. The agentpath used in the steps below is for a remote Windows OS as generated in the Attach Settings dialog box. The actual agentpath will vary according to the OS of the remote system.

GlassFish 3.x

To attach to a remote instance of GlassFish you need to modify the asenv.bat configuration file and domain.xml.

  1. Locate the asenv.bat configuration file for the server which you should find in $AS_INSTALL/config/asenv.bat where $AS_INSTALL is the GlassFish v3 installation directory.
  2. Confirm that the server is configured to run on Java 6 or 7. To set the target JVM for the server you can modify the line of asenv.bat containing the "AS_JAVA" entry as follows
    AS_JAVA="<path to Java SE 7 (JRE or JDK) directory>"
    where the path to the JRE or JDK is the full path.
  3. Locate the domain.xml configuration file for your domain which you should find in $AS_INSTALL/domains/<YOUR_DOMAIN>/config/domain.xml where <YOUR_DOMAIN> stands for the actual domain (typically "domain1").
  4. Modify domain.xml to add the following <jvm-options> xml element inside the <java-config> element.
<profiler enabled="true" name="NetBeansProfiler">
<jvm-options>-agentpath:<remote>\lib\deployed\jdk15\windows\profilerinterface.dll=<remote>\lib,5141</jvm-options>
</profiler>
where <remote> is the full path to the Remote Profiling Pack directory. After you modify files, start the server from the $AS_INSTALL/bin directory using the following command:
asadmin start-domain --verbose <YOUR_DOMAIN>

The JVM will start, but will not proceed with server execution until you connect the profiler.

WebLogic 9+

To attach to a remote instance of WebLogic you need to modify the startWebLogic.cmd startup script.

  1. Go to your domain directory $ORACLE_HOME/<PATH_TO_YOUR_DOMAIN>/bin, where $ORACLE_HOME is the installation directory of your Oracle products and <PATH_TO_YOUR_DOMAIN> is the actual path to your domain, for example "user_projects/domains/base_domain".
  2. Locate the file startWebLogic.cmd.
  3. Modify startWebLogic.cmd to add the following settings at the beginning of the file immediately before the line containing # --- Start Functions ---
JAVA_VENDOR=Sun
JAVA_HOME="<path to Java JDK>"
JAVA_OPTIONS=%JAVA_OPTIONS% -agentpath:<remote>\lib\deployed\jdk16\windows\profilerinterface.dll=<remote>\lib,5140
where <remote> is the full path to the Remote Profiling Pack directory.

After you modify the file, start the server using startWebLogic.cmd. The JVM will start, but will not proceed with server execution until you connect the profiler.

JBoss 4+

To attach to a remote instance of JBoss you need to modify the standalone.conf.bat/standalone.conf script.

  1. Locate standalone.conf.bat in the $JBOSS_HOME/bin/ directory, where JBOSS_HOME is the JBoss installation directory.
  2. Add the following lines at the beginning of standalone.conf.bat/standalone.conf:
JAVA_HOME="<path to JDK directory>"
JAVA_OPTS=-agentpath:<remote>\lib\deployed\jdk16\windows\profilerinterface.dll=<remote>\lib,5140
where <remote> is the full path to the Remote Profiling Pack directory.

After you modify the file, start the server using standalone.bat/standalone.sh file.
The JVM will start, but will not proceed with server execution until you connect the profiler.

Tomcat 6+

To attach to a remote instance of Tomcat you need to modify the catalina.bat startup script.

  1. Locate catalina.bat in the $CATALINA_HOME/bin/ directory, where CATALINA_HOME is the Tomcat installation directory.
  2. Add the following lines at the beginning of catalina.bat, immediately after the help text:
JAVA_HOME="<path to JDK directory>"
CATALINA_OPTS=-agentpath:<remote>\lib\deployed\jdk16\windows\profilerinterface.dll=<remote>\lib,5140
where <remote> is the full path to the Remote Profiling Pack directory.

After you modify the file, start the server using catalina.bat.
The JVM will start, but will not proceed with server execution until you connect the profiler.





Applies to NetBeans IDE 7.2

Back to NetBeans IDE Profiling FAQs

Back to NetBeans User FAQs

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo