Friday, February 13, 2015

Profiling using JVisualVM


Got chance to do performance analysis for java application, For that used JVisualVM for application profiling, heap dump, thread dump analysis
Add following details in application's jvm config
-Dcom.sun.management.jmxremote.port=<jmx port>           
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Djava.rmi.server.hostname=<tomcat server ip>         
Open /java/bin/jvisualVM on localhost
  - Add Remote host
  - Add JMX connection host:jmxport
once you above connection details, you will get panel for application with Overview,Monitor,Threads,Sampler tabs
1. In Monitor tab you can see CPU usage for that application, HEAP monitoring, loaded classes, total Threads 
 2. In Threads tab you monitor Live Threads, Finished threads.
3. One of the important tab is Sampler for profiling the application with respect to CPU, Memory
   - Once you click on CPU, JvisualVM started collection of method's self time and Self Time(CPU). You can also see Thread CPU time
   IMP:-
    Self Time: total time spent invoking this method. If a method was called twice, the self-time will be the sum of the time spent in each call excluding internal method calls.
    Self Time (CPU): the same as Self Time except that only CPU execution time is considered, omitting I/O operations.
    Total Time: total time spent invoking this method including internal method calls.
    Total Time (CPU): total CPU time spent invoking this method including internal method calls
   - Memory profiling :- Here you can see loaded classes and its instances with its size in bytes

In Profiling, From CPU  snapshot we can identify the methods which having high self time (cpu), no. of methods invocation and we can work on it as performance bottleneck.
We can do more performance analysis during heap dump, thread dump



Reference:--
https://blogs.oracle.com/nbprofiler/entry/profiling_with_visualvm_part_1

https://profiler.netbeans.org/docs/help/5.5/results_objliveness.html
https://profiler.netbeans.org/docs/help/5.5/snap_cpu.html
 

No comments:

Post a Comment