Jump to content
We've recently updated our Privacy Statement, available here ×
  • JConsole and JasperReports Server


    gdmoreno
    • Product: JasperReports® Server

    Introduction

    JConsole allows you to monitor a Java Virtual Machine and the applications that run on it. A slightly improved tool similar to JConsole is JVisualVM and they're setup is the same.  By enabling JMX (Java Management Extensions) settings on the JVM at startup, JConsole can then monitor JVM performance and how much resources its applications are consuming.

    JConsole and JVisualVM ship with the JDK, and is thus an ideal starting point for monitoring server activity.

    JConsole is useful for:

    • Monitoring memory usage (heap, non-heap, and native)

    This would tell you how close you are to using the maximum memory you defined for the heap. Looking at its values also gives you sense of how much garbage collection is going on.

    If the application server is getting close to the maximum Java heap size, it might result in excess garbage collection and slowness.

    • Monitoring the number of threads in use

    You might take a look at these values when testing concurrency issues, or to check individual stack traces.

    • Monitoring the CPU usage for the JVM

    This might help you determine whether or not it's the JVM that's responsible for the slowness, or whether it's some other element in the software stack (slow database, slow network connections, slow web server, etc).

    Overview

    This article assumes you are using Tomcat; the equivalent settings for other application servers (such as WebSphere and WebLogic) are left for the reader to verify. I worked out this article's example using a Ubuntu virtual environment; there is nothing to stop you from adapting this example to a Windows environment.

    Modifying the Tomcat startup script

    The first step is to modify the Tomcat startup script to include JMX settings; this will allow the JConsole application to connect to the JMX port and thus monitor the server's activity.

    The first step is to modify the setenv.sh script, which controls the Tomcat startup settings. Add the CATALINA_OPTS variable:

    export CATALINA_OPTS="-Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=8999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=<IP Address>"

    These options turn on JMX functionality, activate port 8999 for JMX monitoring, and set the hostname to the IP address of the machine that's hosting JRS.

    After you have modified the script, you can go ahead and start up the Tomcat server.

    Starting up JConsole

    • From the command line, and as long as the JDK bin directory is in your path, go ahead and simply type "jconsole" into the command line. You should get something like this at start up:

    JConsole1.png.392938a911d49fb6da70d1bb4212aa17.png

     

    • Select the "Remote Process" option and fill in the data with the server name (or IP)

     

     

    JConsole2.png.bb4ca36bab002f2441440760155ec6ef.png

     

     

    • Once you connect, and you are on the "Overview" tab, you'll get a summary view of the JVM state:

     

     

    JConsole3.png.c19d2b18bedb6956a3891a49b5c13ab9.png

     

     

    • Observe the behavior before and after a test condition you're interested in.

       

      If you know that performing a certain task results in slower performance, do a before-and-after comparison to quantify that observation. Using the tool, you'll be able to compare the values for memory usage, thread count, class loading, and CPU usage. For example, you might test:

       

      Ad Hoc Reports - before running them, while you're running them, after they've run

       

      If you see normal values and are still experiencing slow performance (for example, low CPU% but the end user experiences a slow system anyway), then at least you will have eliminated the JVM as the source of your performance issues.

     

    • Analyze the chart data

    Besides just presenting the data graphically, you can download the chart data in CSV format. By simply right-clicking on a chart image, JConsole will give you the opportunity to save the chart data to your disk. This allows to analyze the data with another tool, such as Excel. For example, the data in the Memory tab:

    JConsole4.png.710fb372330bde6f89794206b4e8408e.png

    can be turned into this:

    JConsole5.png.3839d79a8b8eacc5bf6da45d4b1a3d84.png

    Resources

    http://download.oracle.com/javase/6/docs/technotes/guides/management/jconsole.html - This is the official JConsole user guide from Oracle

     


    User Feedback

    Recommended Comments

    We can run and connect to Tomcat's JMX port (8999) without issue. We can't seem to connect to the default 10990 for JasperServer however. We see the port is running, but no combinations of config allow us to connect jconsole to jasperserver on port 10990.

    We're on 611, but switching versions of documentation on this site is a pain. Docs from 550 seem to be similar:

    https://community.jaspersoft.com/wiki/jconsole-and-jasperreports-server
    https://community.jaspersoft.com/documentation/jasperreports-server-administration-guide/v550/exposing-diagnostics-through
    https://community.jaspersoft.com/documentation/jasperreports-server-administration-guide/v550/real-time-diagnostics
    https://community.jaspersoft.com/wiki/video-troubleshooting-jconsole-connections-jmx

     

    Link to comment
    Share on other sites



    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...