In this blog post I’ll lay out few steps that are needed for remote profiling using SSH Port Forwarding (SSH Tunneling) using Yourkit profiler.
Steps to be followed on remote machine:
1) Download Yourkit profiler from official Yourkit website.
2) Extract the downloaded file anywhere.
3) What we need to do now is find the file named libyjpagent.so in the extracted folder corresponding to the system architecture of your remote machine. In my case it is located in yjp-2013-build-13086/bin/linux-x86-64.
4) Copy the libyjpagent.so file to any convenient location (if required), I copied it to /tmp/yjp folder.
5) Add the following VM option to the command line of your Java application:
Here 7878 is the port that you will port forward to.
6) Your remote machine is all set for profiling.
Steps to be followed on local machine:
1) Port forward to remote machine by executing the following command on terminal:
ssh -N -f 22.214.171.124 -L 8085:126.96.36.199:7878
Explanation of what is going on in the above command:
-L 8085:188.8.131.52:7878 is forwarding port 7878 from 184.108.40.206 to localhost port 8085
-N -f parameters are forcing the ssh to go to background.
2) Download Yourkit profiler from official Yourkit website on you local machine as well.
3) Extract the downloaded file anywhere.
4) From terminal go to the following folder:
and start Yourkit profiler using sh yjp.sh.
5) Now from yourkit profiler choose “Connect to remote application” option and enter localhost:8085 in the pop-up that asks for the link to your remote application.
6) Yourkit will start profiling your Java application on remote machine now.