Recently I interviewed the VMware team on the new graphical memory view for the Visual Studio Code Spring Boot Dashboard.
The memory view visualizes the memory, and the garbage collection activities of a running Spring Boot application, much like the Spring Boot Dashboard already provides insights into running Spring Boot applications like active beans and request mappings. The memory view uses the Spring Boot Actuator data to gather the data from the running application.
Spring Boot Actuator is a tool that provides production-ready features to help you monitor and manage your application. It includes several built-in endpoints, such as health, metrics, and environment. It can be accessed through HTTP endpoints or JMX beans and is available once added to the classpath.
There are four graphical real-time visualizations available under the memory view:
- Heap memory – provides a stacked overview of the different heap areas, the total memory used and the total memory size in the JVM. Heap dumps help analyze memory usage and identify potential memory leaks. By analyzing a heap dump, you can see which objects are consuming the most memory, and you can trace the references between objects to understand how they are related.
- Non-heap memory – In a Spring Boot application, non-heap memory refers to the portion of the Java Virtual Machine (JVM) memory used to store data other than objects created by the application. Non-heap memory stores class definitions, internal JVM data structures, and different types of data not stored on the heap.
- Gc Pauses – depicts the frequency and duration of pause time for a GC event. Monitoring the GC pauses metric can help understand the impact of garbage collection on the performance of your application. If the GC pauses are excessively long, it could indicate that the GC is having difficulty keeping up with the amount of garbage generated by the application, which could lead to performance issues.
- Garbage Collection – displays the count of the GC events in the application and the time spent performing garbage collection. This can be useful for monitoring the garbage collector's performance and identifying potential issues with memory usage or garbage collection.
The live memory view can monitor the memory on a remote cloud instance. So, for example, if you have an Azure Spring Apps instance running on Azure, you can directly run it in the Spring Boot extension (if you have Azure Spring Apps extension installed on VS Code) and view its live memory information. In the future, we will let more cloud providers integrate into this view.
- Launch VS Code
- Install the Spring boot extension pack: https://marketplace.visualstudio.com/items?itemName=pivotal.vscode-boot-dev-pack.
- Open a Spring Boot project in Visual Studio Code.
- Click on the Spring Boot icon in the left-hand menu to open the Spring Boot Dashboard.
- From the dashboard, you can view and manage your Spring Boot applications and perform everyday tasks such as starting and stopping the application and viewing logs.
- Right-click on a specific app and choose to start or debug it.
- View the Memory window and select one of the following metrics:
- Heap Memory
- Non-Heap Memory
- Gc Pauses
- Garbage Collections
GREAT Update but Remember if someone not Showing Memory Goto pom.xml and Add spring-boot-starter-actuator dependency after add you used this feature