Backend Handbook
Leapwise
  • 👋Introduction
  • Software Design Principles & Clean Code
    • Atomicity
    • Modularity
    • Hierarchy
    • Loose coupling
    • Asynchronous programming
  • Development Practices
    • JavaDocs
    • Technical Debt
    • Testing Guidelines
      • The Importance of Test Automation
      • The Testing Pyramid
        • Unit Tests
        • Integration Tests
        • End-to-End Tests
      • Mutation Testing
      • Contract Tests
        • REST Controller Contract testing
        • OpenAPI Contract testing
      • Testing Frameworks
        • JUnit 5
        • Testcontainers
        • Mockito
      • Writing Clean Tests - Best Practices
    • Common library
    • Generic CRUD
    • Update Facade
  • Development Tools & Environment
    • Monitoring
    • Performance tuning
    • Multi-tenancy & Configuration Management
    • Git practices
    • CI/CD
    • Maven
  • Project Management
    • Jira
    • Confluence documentation
    • SCRUM
    • Our ways of working
  • LIFE AT LEAPWISE
    • Introduction
    • Who are we?
    • What do we do?
    • Our values
    • Hiring process
      • Hiring: A Mid Frontend Developer's Point of View
    • Benefits we offer
    • Onboarding process
      • Onboarding: A Senior Digital Marketing Specialist's perspective
    • Mentorship program
    • Career development
      • Trainings & certificates we offer
      • Career development: A Senior Software Developer's Insight
    • Community building
    • Juniorship
    • First-hand info from our first team member
    • Join our team
Powered by GitBook
LogoLogo

Company

  • About
  • Culture
  • Services

Insights

  • Leapwise Newsletter
  • Blog

© Leapwise

On this page
  • About
  • VisualVM as IntelliJ plugin
  • VisualVM features
  • VisualVM Dashboards

Was this helpful?

  1. Development Tools & Environment

Monitoring

PreviousUpdate FacadeNextPerformance tuning

Last updated 12 months ago

Was this helpful?

About

Monitoring Java performance involves observing and examining how Java applications run in real-time to find and fix performance bottlenecks. This practice assists developers in guaranteeing that Java applications operate seamlessly, effectively meeting performance expectations. Important components of Java performance monitoring encompass metrics, profiling, heap dump analysis, garbage collection analysis, thread analysis, and continuous real-time monitoring. Without proper tools, identifying and resolving the root causes becomes challenging, leading to recurring problems in your application.

In this guide, we'll explore the utilization of VisualVM as the selected tool for monitoring.

VisualVM as IntelliJ plugin

In Leapwise, backend developers are using IntelliJ as IDE - this is important because it is easy to add the profiling plugin - VisualVM (note: VisualVM is part of JDK8. Starting from JDK9, it needs to be installed as a standalone application). Image 1. shows the options (marked red) that will be available in the IntelliJ Toolbar after the plugin is installed - from left to right options are Run application with VisualVM, Debug application with VisualVM, and Start VisualVM. Run and Debug options VisualVM variations of classic Run/Debug application options.

The third option opens the GUI in which we can use several useful features on both local and remote running applications.

VisualVM features

The most useful VisualVM features include:

  1. Monitoring and Profiling: allows monitoring of various aspects of a Java application, such as memory usage, CPU usage, thread activity, and garbage collection. It also provides profiling capabilities, enabling developers to analyze the performance of their code and identify bottlenecks.

  2. Visual Representation: The tool presents data in a visually intuitive way, using charts, graphs, and tables to help developers quickly grasp the performance characteristics of their applications. This visual representation is particularly useful for identifying patterns and trends over time.

  3. Thread and Heap Dump Analysis: VisualVM supports the generation and analysis of thread and heap dumps. Thread dumps help developers understand the state of threads in the application, while heap dumps provide insights into memory usage, allowing for efficient memory management.

  4. Remote Monitoring: VisualVM supports remote monitoring, allowing developers to connect to and monitor Java applications running on remote machines. This is particularly beneficial for analyzing and optimizing applications in production environments.

VisualVM Dashboards

Monitor

Image 2. shows the main dashboard of VisualVM that provides a graphical representation of key metrics split into different sections:

  1. CPU Section:

    • The CPU section displays information about the application's CPU usage, both in terms of total usage and usage by individual threads.

    • This data can be used to identify CPU-intensive methods and optimize code for better performance.

  2. Heap Section:

    • This section provides detailed information about the Java heap, including heap usage, garbage collection activity, and heap dump options.

    • Developers can analyze the composition of the heap, identify memory leaks, and take heap dumps for further inspection.

  3. Classes Section:

    • This section provides details about loaded classes, unloaded classes, and class loading activity. It helps developers understand the class lifecycle and identify any issues related to class loading.

  4. Threads Section:

    • The Threads section offers insights into thread activity within the application. It displays information about the number of active threads, their states, and any thread dumps that have been generated.

    • This information can be used to identify thread contention, deadlocks, or inefficient thread usage.

Threads

Image 3. shows the VisualVM Threads dashboard. The main section of the Threads tab displays a list of all threads currently running in the Java Virtual Machine (JVM). Each thread is represented by a row with information such as thread name, ID, state, and priority. Visual representation of thread states through color-coded icons makes it easy to identify threads that are actively executing, waiting, blocked, or sleeping.

VisualVM allows users to capture thread dumps, which provide a snapshot of the current state of all threads in the JVM. Thread dumps are crucial for diagnosing thread-related issues such as deadlocks or thread contention.

VisualVM plugin installed in IntelliJ
VisualVM main Monitor dashboard
VisualVM Threads dashboard
Page cover image