Jump to content
Changes to the Jaspersoft community edition download ×
  • Capturing Detailed Middle Tier Performance and State Information


    jwhang
    • Product: JasperReports® Server

    Enable JMX for the virtual machine

    Low level information about the state of the virtual machine running TIBCO. JasperReports® Server may be obtained by using Java's JMX functionality. To create a generic access point on the virtual machine for Tomcat, the following command line arguments may be added to the start of the virtual machine:

    Dcom.sun.management.jmxremote.port=9999
    Dcom.sun.management.jmxremote.authenticate=false
    Dcom.sun.management.jmxremote.ssl=false
    

    In most network configurations, you will also need these two properties:

    Dcom.sun.management.jmxremote.rmi.port=<same as chosen JMX port (above)>
    Djava.rmi.server.hostname=<JRS host name or IP address>
    

    *Note: This is not a complete list and will enable a connection without any authentication or transport layer security. Additional options may be found in the official documentation available on the Oracle website, e.g. http://docs.oracle.com/javase/8/docs/technotes/guides/management/agent.html

    If TCP port 9999 is already used by another service, please choose an unused port, ideally a non-privileged port number (greater than or equal to 1024), as privileged ports require root access.

    Please BE AWARE of the security implications, you will want to open the JMX port only to specific trusted hosts.

    The file to amend will differ depending on operating system and mode of startup:

    • Windows OS service: An executable within the Apache Tomcat home/bin folder will need to be executed. The name of the executable should match the name of the service being used <service name>w.exe
    • Windows batch file: Located within the Apache Tomcat home/bin folder is a file named "setenv.bat". The options may be added to the JAVA_OPTS variable.
    • Linux: Located within the Apache Tomcat home/bin folder is a file named "setenv.sh". The options may be added to the JAVA_OPTS variable.
    The middle tier will need to be restarted for the change to take effect.

    Retrieving State Information

    The "VisualVM" utility may be used to connect to the server to obtain performance and heap information. This utility is bundled with Java Development Kits, but may also be downloaded from: https://visualvm.github.io/

    After launching the application, a connection definition with the same port specified in the step above may be created by right clicking on a node in the Applications tab visible in the left pane. A connection may be established by double clicking on the newly created connection node:

    Obtain a Performance Snapshot

    1. click on the "Sampler" tab and click on the Sample: [CPU] button on the upper left.  This should produce a view similar to below:

      step2_0.png.f96604233d37bfec9e9acad6ab30ce51.png

    2. When done sampling, click the "Stop" button. Within the "CPU samples" tab, click on the "Snapshot" button which should add another tab similar to below:

      step3_0.png.9dc7294d4bed6d7da0c0a1f0e935c77c.png

    3. Click on the disk icon in the upper left of the frame to export the data, and save as an ".nps" file.

    Obtain a Heap Dump

    1. A heap dump may be obtained by right clicking on the JMX connection node in the Applications pane located on the left of the application, and selecting the heap dump option.  Creating a heap dump will add a sub node which appears similar to the below:

      step4.png.8627e5e9ffb0afc19c77675bfe1c601b.png

    2. Right clicking on the heap dump node presents an option to "save as...". Save the file in .hprof format.


    Example of using VisualVM

    See article with a demo of VisualVM and a screencast attached (bottom of page): Basic Tools for Performance Optimization.

    Using VisualVM in a Kubernetes cluster

    See article: Connecting VisualVM to JMX on Kubernetes pod via SSH tunnel.

    The success of this setup will depend on your network configuration and permissions granted by your K8s admins.


    User Feedback

    Recommended Comments

    There are no comments to display.



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...