Has been a while since we have been talking about jVisualVM and its powerful features in helping you debug Java memory/thread problems. On this blog We will go over a few key features that we use to troubleshoot performance issues as well as going over details on how to use these features. We will separate this conversation in 3 separate sections.
1 - What is jvisualVM and where do you get it. 2 - How can it help solve performance issues. 3 - How to connect to ARSystem from jVisualVM.
1 - What is jvisualVM and where do you get it?
jVisualVM is a tool that provides visual interface for viewing details about Java applications while they are running on Java Virtual Machine (JVM). One of the coolest things about jVisualVM is that not only it can organize data that it retrieves from local applications but it can also be used to view remote applications. (in this example we go over the remote hosted applications)
This nifty utility is packaged with a copy of the jdk, however if you decide that you do not need a jdk you can also download a stand alone version here -> https://visualvm.github.io/download.html (you will find instructions on the same page how to deploy it on your laptop/desktop)
2 - How can it help solve performance issues.
jVisaulVM can be used to collect java memory and thread dumps which can later be analyzed and you can pinpoint where ARSystem is having issues. On remedy9 if you are experiencing performance issues you will be asked to collect heap and thread dumps for analysis.
3 - Requirements to use jVisualVM
- Configuration requirements (ar.cfg or Centralized Configuration)
- Make sure that Jmx-port: 61500 line exists on your configuration file (ar.cfg or Centralized Configuration)
- AR System java environment configuration
- jvm.option.<number>=-Dcom.sun.management.jmxremote (Allows for remote connection via "Java Management Extensions(JMX)", like jVisualVM
- Both options tell Java VM to create a heap dump of memory to the Path indicated. (this happens only if java exhausts its memory allocation)
4 - How to connect to ARSystem from jVisualVM
First run jVisualVM form a system other than the ARServer in question (this is best practice). Make sure that the server has adequate space to store the heap dumps. Heap dumps are .hprof files the same size as the memory consumption at the time you take the heap dump. This can cause the system to run out of space and cause configuration file truncating.
Go to File > Add jmx Connection ( you will see a pop up window that looks like the image to the right, without the data)
As connection string you will use the following format:
Check the box for "Use Security credentials" make sure here you enter a username that has admin permissions and has a hard coded password. To save these credentials for future use check "Save security credentials".
You should not need a SSL connection to authenticate, so you can check "Do not require SSL connection" (see below for end result before clicking yes. We are making the assumption here that your resolvable server name is remedydev as well as the admin user is Demo.
Once you click ok the new connection should appear under Remote to the far left. (see below for what it would look like, in this case clm-aus-014185 is my resolvable server name and Terry is my user with a hard coded password)
|Double click on this new remote connection and you will open that instance on your right. (see below for example)|
This image to the right is depicting the overview tab, this tab is quite informative for example in the image above you can see all the jvm arguments that you have on your arserver.config file if you click on the tab to the right of that "System properties" you will be able to see all the java environment variables.
Let's review the Monitor tab next to the Overview tab. (Monitor tab will look very different for you because you are on an active system)
Within the Monitor Tab (the image to the left) you will see 4 separate blocks of charts. Upper left is the CPU utilization and activity. To the top right you will see memory utilization it also indicates how much heap you have as maximum and how much you are using. Bottom left shows all the java classes loaded on the java environment.
Bottom right shows all the threads alive and peak as well as daemon threads.
You have successfully taken a heap dump using jVisualVM.