How to know how much the app is consuming from memory? Where is the application bottleneck? How are the application Threads? How many classes are being loaded? How many instances are being created?
You can answer these questions by monitoring the JVM and using Profiling (this is the process of monitoring parameters at the JVM level, such as Method Execution, Thread Execution, Object Creation, and Garbage Collection).
In the post about testing tools (Let’s try something different: Testing Tools 01) it was possible to measure if the application tolerates X accesses, the response time of the application and etc. Now let’s measure HOW the JVM is reacting to this.
For this example, we will use VisualVM because it is free, easy to use and has a good amount of information, and we will also use the java-sample-project project. The use of VisualVM is very simple: when downloaded, you unzip it and execute the visualvm file inside bin folder. Follow the guidelines in the Java Sample Project to run the project. When VisualVM and the project are started, VisualVM should look like this: