JVM Monitor

Applies to ReadyAPI 3.53, last modified on May 15, 2024

You use JVM monitors to check metrics of your Java virtual machines.


To monitor a Java application, you need to prepare it for testing.

Monitoring an Application Without Authorization

If you do not use authentication for your Java machine monitors (for example when you can only access them from computers in a local network), you need to expose the port that ReadyAPI will use to connect to the machine. You also need to explicitly disable SSL security and authentication.

You do this by modifying your VM settings. The simplest way is to create a batch file (.bat or .sh) with the following lines:

java ^
-Dcom.sun.management.jmxremote ^
-Dcom.sun.management.jmxremote.port=9999 ^
-Dcom.sun.management.jmxremote.ssl=false ^
-Dcom.sun.management.jmxremote.authenticate=false ^
-jar MyApp.jar
On Linux, .sh files must be in a single line without caret symbols (^).

You can find detailed instructions on the Oracle website.

Monitoring an Application With Authorization

Adding authorization is more complex. You need to create files that hold user credentials and permissions, and specify them in your VM settings.

  • First, create a file that holds user credentials. It can be a simple text file. For example, create a password.txt file with the following text:

    MyUser MyPassword
  • Java requires that the file with user credentials belongs exclusively to the owner of the file. Usually, your operating system provides all users with access to the file. To make sure you have correct permissions, use the following commands:

    • On Windows:

      1. Use icacls password.txt /setowner MyOwner, where MyOwner is the name of a user that launches the application.

      2. Use the cacls password.txt /P MyOwner:R command, where MyOwner is the same user you set as the owner.

    • On Linux and Mac, use the chmod 600 password.txt command.

  • Then, create the file that holds user access permissions. It can be a simple text file. Users do not need write permissions to access monitors. Create an access.txt file with the following text:

    MyUser readonly
  • Modify your VM settings to allow remote connections. The simplest way to do this is to create a batch file (.bat or .sh) with the following lines:

    java ^
    -Dcom.sun.management.jmxremote ^
    -Dcom.sun.management.jmxremote.port=9999 ^
    -Dcom.sun.management.jmxremote.ssl=false ^
    -Dcom.sun.management.jmxremote.authenticate=true ^
    -Dcom.sun.management.jmxremote.password.file=password.txt ^
    -Dcom.sun.management.jmxremote.access.file=access.txt ^
    -jar MyApp.jar
    On Linux, the above code should be in a single line without caret symbols (^).

You can find detailed instructions on the Oracle website.

Monitoring an Application on a Remote Computer

If you cannot connect to JVM running on a remote computer, add the following line to your configuration file:


Where <Host_Name_Or_IP> refers to the IP address or host name of the computer running your application.

Resolving Connection Issues for Linux Machines

ReadyAPI cannot connect to a Linux machine if its name is resolved as a local address, or if the Linux computer does not accept requests from the computer running ReadyAPI. If you have connection issues, check the following:

  • Run the hostname -i command. If it returns a local IP address (for example,, edit /etc/hosts so that the hostname resolves to the host address.

  • Execute the following command to add a rule to allow requests from external clients:

    sudo iptables -I INPUT -s <R!_Host_Name_Or_IP> -p tcp --destination-port <JMX_Remote_Port> -j ACCEPT

Monitor Settings

The monitor has the following settings:

  • Port – The port used to communicate with the server. Defaults to 161.

  • User name – The user account ReadyAPI Performance uses to connect to the machine.

  • Password – The password used to connect to the machine.

Frequently Used Metrics

The JVM monitor provides information about the Java machine that runs your application. Here are some frequently used metrics:

  • VM Memory – Heap Memory Used – Heap is memory used by the Java application. If your application runs out of heap space, your JVM can stop, or even crash without saving data. Heap usage increasing over time is a sign of a memory leak.

  • VM Threading – Thread Count – Java virtual machines use Threads to process data. Having a large number of threads is a sign of high CPU usage, and can cause issues with both the application and the server running it.

Other Metrics

ReadyAPI can access the following JVM monitors:

Category Description Metrics
Operating System Information about the computer running JVM. Swap Space Total
Physical Memory Total
Virtual Memory Committed
Swap Space Free
System CPU Load
Physical Memory Free
VM Garbage Collector Provides information about JVM garbage collectors. You can gather individual metrics for each collector. Collection Count
Collection Time
VM Memory Provides information about JVM Heap usage. Heap Memory Used
% Heap Memory Used
Heap Memory Committed
Heap Memory Max
VM Threading Provides information about Threads used by the JVM. Total Started Thread Count
Daemon Thread Count
Peak Thread Count
Thread Count

See Also

Preparing Servers for Monitoring
Server Inspector

Highlight search results