How to monitor JVM usages for Websphere Applications? - jvm

I'm trying to monitor JVM usages in IBM Websphere Server. Normally I use jstat tool from the JDK but since that's not available with IBM WAS, is there any other tool available for the same?

WAS uses IBM's J9 JVM under the hood. So, some of the HotSpot JVM's debugging tool will not work with it. WAS exposes all details using Performance Monitoring Infrastucture(PMI). You should be able to get lots of metrics using it. You need to enable this feature in order to get metrics.

Related

Jprofiler latest products and features compatible with azure

Is jprofiler current version and other new ej technologies new products can be used for profiling and monitoring azure, AWS?
JProfiler profiles JVMs. Whether it can profile a particular JVM depends on the architecture and the version of the JVM, but not on the cloud service where the JVM is running.
For a current list of supported platforms and JVMs, see
https://www.ej-technologies.com/products/jprofiler/featuresPlatforms.html

How does Visual VM interact with JVM to get all the information ? Is there any API's exposed by JVM to do so?

How does Visual VM interact with JVM to get all the information. Is there any API's exposed by JVM to do so ? \
Yes, this is done mostly through JMX API.
There are public standardized MBeans for JVM monitoring:
ThreadMXBean
RuntimeMXBean
MemoryMXBean
ClassLoadingMXBean
etc., see java.lang.management package.
And there are also private HotSpot-specific MBeans under sun.management package:
HotspotClassLoadingMBean
HotspotCompilationMBean
HotspotMemoryMBean
HotspotRuntimeMBean
HotspotThreadMBean
Besides JMX HotSpot JVM has other diagnostic APIs:
Jvmstat Performance Counters, aka PerfData
Dynamic Attach API
JVM Tool Interface
By the way, VisualVM is open source, you may download the sources to see everything yourself.

How to monitor JVM without installing JDK

I want to monitor JVM performance on my production environment. I have installed only JRE, not JDK, Hence i can't use jstat, jconsole etc. to monitor the JVM performance.
Can somebody please help to understand how can i monitor JVM performance in this scenario?
Is there any way to achieve this?
(please note that i don't want to monitor it remotely through JMX or something else. i would like to install local agent in each machine which will send the metrics to server at the interval of 1 minute.)
Thanks,
KS
If you manage to get JMX up and running on your VM (from the comment), you can then use jmxterm or jmxfetch to push these JMX metrics into a metrics system (like graphite or Datadog).
If you have enough patience and time to write, you can probably have a look at JVMTI. You can write your code in C/C++ and run it along your Java Process and you can gather information about the JVM without affecting it.
Another simple and naive way is to start your VM with a javaagent written in java but JVMTI is even better than that. The most crucial difference between the javaagent and JVMTI app is derived from the loading mechanics. While the agents are loaded inside the heap, they are governed by the same JVM. Whereas the JVMTI agents are not governed by the JVM rules and are thus not affected by the JVM internals such as the GC or runtime error handling.
You can even give Java Mission Control a try if you're using JDK7 or above :)
Jolokia is a java agent you can use to expose JMX as http. Run jmx2graphite and get those metrics into Graphite. The link includes instructions on Graphite installation (10 minutes)

Obtain useful data from WebSphere JVM

I would like to attach to a WebSphere JVM and obtain useful data like garbage collectors' names and their collection counts, thread counts, heap/non-heap memory usage, JVM uptime etc. However, this link gives the list of MBeans available with the WebSphere JVM -
http://pic.dhe.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=%2Fcom.ibm.websphere.javadoc.wsfep.doc%2Fweb%2FmbeanDocs%2Findex.html
These MBeans don't seem to offer any data that I require. Is there any other way to obtain the data? I shall be using JMX to gather it.
If you're a corporate with bucks to spend I would suggest a product like Wily Introscope which runs an agent along with your JVM to collect all the metrics that you are after. I have used it with Websphere servers. Searching for an Open Source alternative I came across GlassBox which may provide a low cost alternative for you.
I'm not aware of any default MBeans that will provide the coverage you're after. It's typically the big Java vendors that provide this type of functionality.
[Update]
Having done something recently using VisualVM with Websphere 7, for the purposes of real-time monitoring/troubleshooting, I thought I would share my knowledge. VisualVM comes with the standard Sun JDK and you will find it installed here: JAVA_HOME\bin\jvisualvm.exe
To enable the JRE in Websphere to allow VisualVM to connect you must add the following JVM parameters using the Websphere Admin Console
Go To: Application Servers > [server_name] > Java and Process Management > Process definition > Java Virtual Machine > Generic JVM arguments
-Djavax.management.builder.initial=
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.port=1099
-Dcom.sun.management.jmxremote.local.only=false
Make sure that the port number you have chosen above is not already in use
netstat -ap | grep 1099
Restart the server and you will be able to connect using VisualVM to see Uptime, Threads, Heap and GC profiles.
I see that Sun have also documented how you can write your own Java JMX client to read these values.
You could go with the suggestions provided by Brad and Andreas.
I would like to give you some insights into some of the tools that should be explored
(1) Tivoli Performance Viewer. This should provide some information about the JVM.
(2) IBM Health Center -> http://www.ibm.com/developerworks/java/jdk/tools/healthcenter/
Both of these should provide you a lot of info that you require.
Try them out
The JVM statistics are provided by the platform MXBeans. If you need to collect this data over a short period of time, then you could use a tool such as VisualVM. It's a bit tricky to configure this to connect to a WebSphere instance, but it is possible. One way to do that (there are other options) is described here:
http://code.google.com/p/xm4was/wiki/VisualVMHowTo
If you want to collect the data over a longer period of time, then you need a monitoring system. At work, I wrote a plugin for the Open Source RHQ enterprise management system that adds support for WebSphere. I'm in the process of releasing this plugin as an Open Source project, but at the time of writing, I have not yet published the documentation and there is also no downloadable release yet. Only the source code is available right now. I will try to complete that in the next weeks. If you are interested in this project, please let me know.

WebSphere JVM MXBeans

When using Oracle JVM, we can obtain a large amount of useful JVM data using the provided MXBeans like GarbageCollectorMXBean, MemoryMXBean etc. Are the same MXBeans available in case of a WebSphere JVM ?
Thanks in advance.
Yes, they are available also on WebSphere, but it is somewhat tricky to access them remotely. I just completed a documentation that explains what you need to know to access these MXBeans:
http://code.google.com/p/xm4was/wiki/WebSphereJmx
The XM4WAS project also provides some tools to make that easier. The following document describes how to use them to set up VisualVM to monitor a WebSphere JVM:
http://code.google.com/p/xm4was/wiki/VisualVMHowTo
Yes, if it is java 1.5+.
WAS also has PMI you should look into.