Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

BMDSoftware/rmjvm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Resource Monitor for Java (rmjvm)

Description

Resource Monitor for Java is a tool that helps to monitor Java process resources and detect memory leaks/CPU constrains.

How to use?

Before you use this tool, you need to be aware what are your goals. First step, is to understand what kind of application that you need to monitor and what are the moments to monitor and actions that you need to trigger.

rmjvm 1.0
usage: rmjvm [-c] [-cf <arg>] [-e <arg>] [-ed <arg>] [-h] [-ho <arg>] [-p
       <arg>] [-s <arg>]
 -c,--check                    check will run all the actionsand wait
                               until it is requested to stop. Meanwhile it
                               will monitoring the memory and compare
 -cf,--config <arg>            the configuration file (by default
                               conf/rmjvm.yml)
 -e,--export <arg>             export format (csv, output)
 -ed,--exportdirectory <arg>   export directory where will be stored the
                               files.
 -h,--help                     help shows how to use the rmjvm and what
                               its core funcionality
 -ho,--host <arg>              set the hostname for JMX of java listen
                               process
 -p,--port <arg>               set the port for JMX of java listen process
 -s,--skip <arg>               skip the cpu or memory (--skip=mem,cpu)

Examples

Few examples of use of the application:


$ rmjvm --help 
$ rmjvm --version 
$ rmjvm --check 
$ rmjvm --skip mem
$ rmjvm --skip cpu,mem
$ rmjvm --export csv --exportdirectory /tmp/dump-reports --config conf/rmjvm-myApp.yml 

Configurations

### Please modify according your needs
application:
  uri: "service:jmx:rmi:///jndi/rmi://<YOUR-JMX-HOST>:<YOUR-JMX-PORT>/jmxrmi"
  directory: "<DIRECTORY WHERE IS LOCATED JAVA APPLICATION>"


# This is just few examples for monitoring

actions:
  - name: monitor01
    cmd: "sendFilesApp -h hostname"
    timeout: 200 # ms
    monitor: ['cpu', 'mem']
    executions: 20
  - name: monitor02
    cmd: "receiveFilesApp -h hostname"
    monitor: ['mem']
    timeout: 100 # ms
    executions: 2

# configure a tracer
# there are few examples, such zipkin
tracer:
  - uri: "http://my-zipkin-deployment:9201"

Configure your Java Application

You will need to configure the following properties, that will allow to JMX connection allowed by remote applications:

 -Dcom.sun.management.jmxremote.port=3333  
 -Dcom.sun.management.jmxremote.ssl=false  
 -Dcom.sun.management.jmxremote.authenticate=false

Output - export format

There are summary metrics to measure:

ActionName,ExecutionIteration,Timestamp,UsedMemory,CPUTime
monitor-1,0,2019.06.03.17.20.21,19800024,46190000000
monitor-1,1,2019.06.03.17.20.25,19856992,46900000000
monitor-2,0,2019.06.03.17.20.26,19917168,46900000000
monitor-2,1,2019.06.03.17.20.28,19977176,46900000000

There are two outputs, Heap:

ActionName,ExecutionIteration,NameOfObject,ByteOrderBySize,Size,Count
monitor-1,0,java.lang.String (retained),58918,58918
monitor-1,0,int[],29849,29849
monitor-1,0,char[],60273,60273

Recommended tools

You should be aware at least of the following tools, that probably could help you find your issues:

  • jConsole

  • Mission Control and Flight Recorder

  • Oracle VisualVM

  • JVM tools: https://github.com/aragozin/jvm-tools/

  • Eclipse Memory Analyser: MAT

    Note: rmjvm was mainly developed to track the memory after specific commands and to know exactly what is increasing over the

    time. Other tools are allowed to do real time monitoring and explore/monitoring and trigger specific JMX Mbeans. The main

    reason to build rmjvm was mainly due to some programatic triggers that was needed.

Other resources

Support

It is an open source project and no enterprise support is provided, only by the community.

BMD Software

Please contact BMD Software for more information.