JProfiler is a popular profiling tool which helps developers monitor a huge number of parameters that are related to the execution of a particular program, such as memory usage, CPU usage, etc thereby providing the ability of identifying memory leaks, threading issues, etc.
The focus of this article is to provide you with an understanding of how to set up the environment for a WSO2 Carbon server to run a profile on it and observe the aforementioned parameters associated with its execution.
Here, I'm using WSO2 Data Service Server to demonstrate the above task on a Ubuntu 64-bit installed machine.
First, go to the bin folder of the distribution of WSO2 Data Service Server (or the intended Carbon Server) and open the server script which is used to run the server. i.e. wso2server.sh
Then, add the following line marked with red (which is automatically generated when you first install JProfiler on your machine) under the heading Execute The Requested Command, to the appropriate position as depicted below.
NOTE: You need to replace "/home/djpro/Installations/" with the location in which the JProfiler is installed in your machine.
Configuring JProfiler locally, to create a new profile..
Step 1: Run the JProfiler application and click on the "Start Center" icon which is in the top left corner of the menu bar. Then the following window will pop up which will guide through the process of creating a new profiling session.
Step 2: Select "New Session" tab and then on the "New Session" button under the sub topic called "Main Configuration".
Step 3: Then, select the "Remote" radio button and enter the IP address(in this instance, it is 127.0.0.1) and the port(default is 8849) of the remote machine which runs JProfiler application. Then press "OK". Don't forget to enter an appropriate name for the session inside the "Session Name" text box.
Step 4: If you could successfully configure the JProfiler session up to this point, you will see the "Session Startup" window asking you to further edit start up attributes of the session.
Step 5: As the final step, run the desired Carbon server which has already been configured to be monitored and click on the "OK" button of the "Session Startup" window.
Now you should be able to successfully run the profiler session for your carbon product. :)