Setting up NetBeans Profiler for a Remote Payara Server on a Windows Host
In this article, we will discuss the steps required to configure NetBeans Profiler for a remote Payara Server running on a Windows host. This setup allows developers to profile and optimize their Java applications running on a remote server, providing valuable insights into performance bottlenecks and memory leaks.
Prerequisites
Before we begin, ensure that you have the following installed and configured:
- NetBeans IDE 16 or later
- Payara Server 5.2021.2 or later
- A Java application deployed on the Payara Server
- Remote access to the Windows host running the Payara Server
Configuring the Payara Server for Remote Profiling
To enable remote profiling on the Payara Server, follow these steps:
- Open the Payara Server administration console in a web browser.
- Navigate to Configurations > server-config > JVM Settings.
- Scroll down to the Java Options section and add the following options:
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=9009
This option enables the Java Debug Wire Protocol (JDWP) on port 9009, allowing the NetBeans Profiler to connect to the Payara Server.
Configuring NetBeans Profiler for Remote Profiling
To configure NetBeans Profiler for remote profiling, follow these steps:
- Launch NetBeans IDE and open your Java project.
- From the main menu, select Profile > Attach Profiler.
- In the Attach Profiler dialog, select the Remote Profiler option.
- Enter the following information:
- Host: The IP address or hostname of the Windows host running the Payara Server.
- Port: 9009 (the same port used for JDWP in the Payara Server configuration).
- Transport: Socket.
- Connection Timeout: 5000 (or a suitable value for your network configuration).
Click the Attach button to connect the NetBeans Profiler to the Payara Server.
Profiling Your Java Application
Once you have successfully connected the NetBeans Profiler to the Payara Server, you can begin profiling your Java application.
- From the NetBeans Profiler main window, select the profiling mode that you want to use (e.g., CPU profiling, memory profiling, etc.).
- Click the Start button to begin profiling your application.
- Use your application as you normally would, allowing the NetBeans Profiler to gather profiling data.
- After you have gathered sufficient profiling data, click the Stop button to stop the profiling session.
Analyzing Profiling Data
Once you have stopped the profiling session, the NetBeans Profiler will display the profiling data in a series of charts and tables, allowing you to analyze the performance and memory usage of your Java application.
In this article, we have discussed the steps required to configure NetBeans Profiler for a remote Payara Server running on a Windows host. By following these steps, developers can profile and optimize their Java applications running on a remote server, providing valuable insights into performance bottlenecks and memory leaks.