I ran memory Profiler using NetBeans and VisualVM and received the results but do not have a clue how to analyze its results, I studied this article but it does not teach or give a clue on how to interpret the results.
I have also found this article about interpreting results on Netbeans 4 but am looking for an article with more details,or a way to interpret the following results to learn.
There really isn't much information conveyed in the telemetry graphs you've pasted in your question.
What is conveyed
I bet the saw-tooth pattern conveyed in the memory visualizer is your program booting - otherwise why do things seem to smooth other in the last minute or so. Was your application under any load during the 3 minute period shown in your question?
As a starting point I'd look at how much time your program spends in GC (Relative Time in GC) when your program is doing some heavy lifting. If it's more than 5%, you may consider tuning your heap or digging further to find out where the allocations are occuring.
Next I would look for a bottleneck. Find out where your application is spending most of it's time, and see if you can somehow optimize that code.
I don't know much about profiler in netbeans but I'd prefer visualvm
. It has wide range of profiling. https://visualvm.java.net/
VisualVM is a visual tool integrating several commandline JDK tools and lightweight profiling capabilities. Designed for both production and development time use, it further enhances the capability of monitoring and performance analysis for the Java SE platform
Sample program for memory test
public class MemoryTest {
public static void main(String[] args) {
ArrayList<String> temp = new ArrayList<String>();
for (int i = 0; i < 1000000; i++) {
temp.add(String.valueOf(i));
System.out.println("index:" + temp.get(i));
}
System.out.println(temp.size());
}
}
Open visualvm
. It'll list your program in left side. Also provide you multiple option to test your program against Memory
and CPU
. You can also profile particular package using it.
This entry is not specific to Netbeans 7 but does have some good simple starters on JVM memory usage and profiling fundamentals. Sometimes a better understanding of the fundamentals uncovers better programming technique for avoiding future memory issues. http://java.dzone.com/articles/java-memory-model-simplified
It is really difficult to find good article on Netbeans profiler. I found this link helpful.
Summary of above three graphs is as below:
Graph (1) In 1st graph, red shading in the first graph indicates allocated size of the JVM heap while purple overlay indicates the amount of heap space actually in use. In this picture allocated heap size is around 450 MB out of which 140 MB is used to hold java objects.
Graph (2) 2nd graph shows heap statistics.
Graph (3) 3rd Graph shows count of active threads in JVM. Too much variation of active counts of threads will eat CPU (context switching).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With