In this blog, I would explain how to do remote profiling on remote machine, if you are not a root user and you have only console access to remote machine.
I have used YourKit for profiling, which is one of the best and user friendly tool for profiling.
Please follow the steps, mentioned below, to step up yourkit on remote machine:-
1) Download tar.bz2 archive
2) Unpack:tar xfj .tar.bz2
3) Set Environment variable
LD_LIBRARY_PATH=//bin/linux-x86-64
4) Run below command and follow instruction
sh /bin/yjp.sh -integrate
After running above command, you would get an agent path.
Add -agentpath:
VM option to the command line of Java application, on which you want to do profiling.
5) Now with command line tool, you can start profiling.
java -jar /lib/yjp-controller-api-redist.jar
You will get a list of options. Pick an option from the list and run above command with that option. It will generate a snapshot.