September 14, 2009

JRockit Mission Control @ OOW 2009

There are a bunch of JRockit related sessions at OOW 2009! Joy!

Here are the ones I am involved in:

Session ID Session Title Date/Time Room

S309689

The Next Generation of Profiling and Diagnostics Tools

Sunday
10/11/2009
10:30 - 11:30

Hilton Hotel
Golden Gate 4/5

S309676

Advanced Java Diagnostics and Profiling with Oracle JRockit Mission Control

Monday
10/12/2009
11:30 - 12:30

Hilton Hotel
Continental Ballroom 4

Other exciting sessions:

Session ID Session Title Date/Time Room
S309305 Oracle JRockit: What's New and What's Coming Monday
10/12/2009
16:00 - 17:00
Marriott Hotel
Salon 7
S309680 Latency Is a Bug: Tuning Your Java Virtual Machine for Optimal Performance Monday
10/12/2009
10:15 - 11:15
Hilton Hotel
Continental Ballroom 4
S309331 A Next-Generation Platform for Virtualized Java Wednesday
10/14/2009
13:00 - 13:30
Moscone South
Room 309

May 7, 2009

Using the PDE Wizard

With the new Experimental Update site, there are now PDE plug-ins for extending the JRockit Mission Control Console. The wizards greatly reduces the time needed to start writing your own tabs, actions and constraints.

This is basically a very short tutorial on how to use them.

Install the PDE plug-ins

  1. First make sure you have Eclipse 3.3 or 3.4 installed.
    You will need the plug-in builder edition.
  2. Next make sure that you have installed JRockit Mission Control 3.1.0 into your Eclipse.
    The update site is here: http://www.oracle.com/technology/software/products/jrockit/missioncontrol/updates/base/3.1.0/eclipse/index.html
  3. Next install the PDE plug-ins from the experimental update site.
    The experimental update site is here:
    http://www.oracle.com/technology/software/products/jrockit/missioncontrol/updates/experimental/3.1.0/eclipse/index.html

Worth noting here is that if you fall for the temptation to also include the JConsole meta plug-in from the experimental update site, you need to be running your Eclipse on a JRockit 1.6 based JVM for the plug-in to work.

Creating a JRockit Mission Control Console PDE project

In this example we’ll create an additional tab in the JRockit Mission Control console. The tab will subscribe to one or more values from the JVM, depending on which wizard you choose.

  1. Create a new Plug-in project by selecting File->New->Project… and then selecting Plug-in Project.
    If that alternative is not available to you, ensure that you have installed the Plug-in Builder version of Eclipse.
  2. Name your Plug-In Project by entering the Project Name in the New Plug-in Project Wizard. Then click next.
    (e.g. com.example.mc.testtab)
  3. Review the details in the Plug-in Content page and then click next.
  4. Select either the Mission Control Complex or Simple Tab wizard.
  5. Review the details in the tab wizard, then click finish.

You now have a project which should compile properly. The plug-in adds a tab to the JRockit Mission Control Console. There are other wizards, for instance one that add actions to the triggers tab in the the JRockit Mission Control Console.

The Experimental Update Site is Now Online!

Since the 3.1 version of JRockit Mission Control, it is possible to extend JRockit Mission Control in various ways. The first extensibility features that we’re releasing are for the JRockit Mission Control Console, with the next major version featuring the same sort of extensibility for the Memleak and JRA tools as well.

Together with exposing these extension points, we also wanted to provide plug-ins that facilitates building extensions for JRMC. Since these plug-ins, strictly speaking, are not part of the JRockit Mission Control product, we’ve tried to come up with a good way for distributing them.

Today we released the Experimental Update Site for JRockit Mission Control. It contains plug-ins for Eclipse and/or JRMC that either extends, or makes it easier to extend, JRockit Mission Control. In this first release, there is a PDE plug-in that provides wizards for extending the JRockit Mission Control console in various ways. There is also a JConsole meta plug-in, that allows you to run JConsole plug-ins in JRockit Mission Control. IMHO, using the PDE-plug-ins to build a native JRMC version of the plug-in is the better way to go. ;)

Everything in the experimental update site is provided as is – it is unsupported functionality, and the plug-ins may be revised and updated without notice. Please use the forum if you have any questions or want to report problems with these plug-ins.

Have fun!

April 7, 2009

Oracle JRockit Mission Control 3.1 Available!

Finally! The new version of JRockit Mission Control is out! It features a much improved user interface, new extensibility features and an experimental update site that will go on-line as soon as we get the go from legal.

Hope you’ll like it! :)

You can download it from the JRockit Mission Control Home Page, either as a stand alone application, or as a set of Eclipse plug-ins that can be run in 3.3 or 3.4 versions of Eclipse.

Here is a minimalistic list of what is new:

General:

  • Accessibility support
  • Links in the help menu to forum and JRMC home page
  • Better copy and paste support
  • Extension points that let you extend JRockit Mission Control

JRMC Console:

  • Updated MBean Browser
    • Can drill down into CompositeData, Tabular Data, Collections and Arrays directly in the attribute table tree
    • Configurable property key ordering for MBeans
    • Automatic updates on new MBeans being registered/unregistered
    • Information tab with MBean metadata
  • Updated dials
    • Gradients
    • Formatting
    • Can add additional dials dynamically
  • MBean Tree & Attribute Selector Dialog
    • Filters with wildcards
    • Improved performance
  • Triggers
    • Import/Export of trigger rules
    • Triggers can be ordered in groups
    • Triggers can now have descriptions
    • Trigger templates for common use cases
  • Attributes
    • Now shows per thread CPU usage
    • Total pause time for the last GC
  • Tab groups / Category toolbar navigation
  • New Diagnostic Commands tab

JVM Browser:

  • A connection can now be tested before added to the JVM Browser tree
  • User configurable application names

JRA:

  • New recording templates
  • Tab groups / Category toolbar navigation
  • New overview tab that aggregate important information
  • New system tab with JVM and OS-related information
  • New recording tab with recording related information
  • New allocation tab
  • New code related overview tab
  • New threads / locks overview tab
  • New latency overview tab
  • New latency thread tab 
  • Histogram moved to new latency histogram tab
  • Improved tooltips
  • Configurable category toolbar

Here are a few screenshots:

tab_code_overviewtab_general_overview

 tab_latency_overview tab_thread_overview

There is also a set of neat experimental plug-ins that will be published as soon as we get the go ahead from legal. The first release of the Experimental Update-site will (at least) contain:

  • PDE Wizards for creating plug-ins for JRockit Mission Control
  • A JConsole Plug-in Plug-in which lets you run JConsole plug-ins inside JRockit Mission Control
    (It is, IMHO, a much better idea to convert them to true JRMC plug-ins though. ;) I just implemented that plug-in for fun.)

For more detailed information about the 3.1.0 release, please check out the “New and Noteworthy” page introduced with this release.

October 28, 2008

Starting the External Agent After JRockit Has Started

So you're in trouble. You've started a long running application. It's taken you half an hour to make the application reach a nice, optimized steady state. Maybe you started JRockit as a windows service. And you really didn't expect the need for having the external management agent up and running. Yet, here you are, longing to connect to the JRockit running your application using Mission Control from another machine. Perhaps to do some profiling, diagnostics or to hunt for a suspected memory leak. You start shutting down the JVM, and expect at least half an hour to pass unti... No! Wait!

Using jrcmd there is a way to bring up the agent after the fact that JRockit has been started. See one of my previous blogs for more information on how to use jrcmd.

To use jrcmd  to start up the external management agent, you use the start_management_server command. Here is an example:

D:\clients\hirt>jrcmd 3848 start_management_server ssl=false authenticate=false port=4711

This command doesn't return any message upon successful completion, but on the console for process 3848 you should see:

[JRockit] Management server started on port 4711, ssl=false, authenticate=false.

August 20, 2008

Getting JRockit Stack Dumps

Sometimes it may seem hard to get a simple thread stack dump from your JRockit. You may for instance have started it using the -Xnohup (-Xrs) option, or as a service. I'll list three different ways of looking at your threads in such situations.

The first way of getting your thread dump is to use jrcmd. My previous blog shows some basic jrcmd usage, so I'll just mention the command name: print_threads. Basic usage is jrcmd <PID> print_threads, for example jrcmd 780 print_threads.

The second way is to simply start the management console on the JRockit you want to monitor. After connecting the console to the JVM and switching to the threads view, you should be looking at something similar to the screen shot below.

thread_dumps

The third way is to use the MBean Browser's capability to invoke arbitrary operations on MBeans (also described in the last blog). Go to the MBean Browser in the JRockit Management Console. Select the DiagnosticCommand MBean, and switch to the operations tab. Select the execute operation that takes a String argument and returns a String. Click the String button, and fill in the argument print_threads.

invoking_dc

When you execute the operation you should see something like this:

after_dc

There are also ways of doing this programmatically, for example by using the JRockit JMAPI, or by invoking the execute operation programmatically as described in another old blog.

August 15, 2008

Simple Exception Profiling with JRockit

Exception profiling is the business of finding out what exceptions are being thrown within your application and from where. In JRockit Mission Control you can find out how many exceptions have been thrown using JRA, and you can count the exceptions using the JRockit Management Console. Sadly there is no way of doing powerful exception profiling (i.e. looking at the stack traces for the exceptions, aggregating them and visualizing them directly in the JRockit Mission Control Client) just yet. This will be incorporated in a future version of Mission Control.

There is fortunately a way to do exception profiling with JRockit today. There are exception related verbose flags available in JRockit. These are examples on how to use them:

java -Xverbose:exceptions=debug ...

java -Xverbose:exceptions=trace ...

For a list of valid verbose options, please see http://e-docs.bea.com/jrockit/jrdocs/refman/optionX.html#wp999543.

Sometimes you really just want to enable this profiling for a little while, for example to avoid cluttering your log files. Then there is a nifty tool for JRockit called jrcmd you can use to turn on/off the exception profiling. It can be found under JROCKIT_HOME\bin\.

First use jrcmd to list all running java processes. Here is an example of what it may look like:

>jrcmd

10984 jrockit.tools.jrcmd.JrCmd

9396 C:\Java\eclipse3.3.1.1\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v200
70828.jar -data D:\Data\workspaces\workspace_3.3_facade -os win32 -ws win32 -arc
h x86 -showsplash -launcher C:\Java\eclipse3.3.1.1\eclipse.exe -name Eclipse --l
auncher.library C:\Java\eclipse3.3.1.1\plugins\org.eclipse.equinox.launcher.win3
2.win32.x86_1.0.2.R331_v20071019\eclipse_1021.dll -startup C:\Java\eclipse3.3.1.
1\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v20070828.jar -exitdata 1908_7
c -vm D:\jrockits\R27.4.0_R27.4.0-90_1.5.0\bin\javaw.exe -vmargs -Xms256m -Xmx51
2m -XgcPrio:deterministic -XpauseTarget:40 -Dosgi.bundlefile.limit=100 -jar C:\J
ava\eclipse3.3.1.1\plugins\org.eclipse.equinox.launcher_1.0.1.R33x_v20070828.jar

10976 Gegga

The numbers are the PIDs of the processes, and are used as the first argument to jrcmd to specify on what JRockit to address. You can use jrcmd to check what commands are available. Here is an example:

>jrcmd 10976 help
10976:
The following commands are available:
        kill_rmp_server
        start_rmp_server
        kill_management_server
        start_management_server
        checkjrarecording
        stopjrarecording
        startjrarecording
        print_object_summary
        memleakserver
        print_codegenlist
        print_class_summary
        run_optfile
        dump_codelayout
        dump_codelist
        dump_codemap
        print_utf8pool
        print_properties
        print_threads
        datadump_request
        runsystemgc
        runfinalization
        heap_diagnostics
        oom_diagnostics
        print_exceptions
        version
        timestamp
        command_line
        memprof
        sanity
        verbosity
        set_filename
        help
        print_memusage
For more information about a specific command use 'help <command>'.
Parameters to commands are optional unless otherwise stated.

Let's get more information about the print_exceptions command:

>jrcmd 10976 help print_exceptions

10976:
Enable printing of Java exceptions thrown in the VM.
To turn exception printing off completely you need to set exceptions = false
even if it was turned on by stacktraces = true. NOTE: This handler is
deprecated. The preferred way of displaying exceptions is to use the
'exceptions' logging module: -Xverbose:exceptions.
Values for the parameters can be "true|all|false"
true  - print all exception except java/util/EmptyStackException,
java/lang/ClassNotFoundException and
java/security/PrivilegedActionException
all   - print all exception
false - don't print exceptions
        exceptions  - print exceptions (string, false)
        stacktraces - print stacktrace (string, false)

Never mind that it is using an old handler in R27.6. The functionality will be the same. Let's enable the exception profiling:

>jrcmd 10976 print_exceptions stacktraces=true

If your application is throwing exceptions, you should now be seeing traces being logged to the console of that application. To turn off the exception logging, we do as the help suggests:

>jrcmd 10976 print_exceptions exceptions=false

Now, an even easier way to access the jrockit diagnostic commands is to use the JRockit Management Console. Simply connect the JRockit Management Console to the JRockit you wish to enable exception profiling on (from JRockit Mission Control). (Click the images to look at them in full size.)

start_console

Once the console is started, open the MBean Browser tab and move to the DiagnosticCommand MBean under bea.jrockit.management:

diagnostic_command

Double clicking on the ArrayList value of AllCommands will open up a list of all the available commands:

list_commands 
Now, select the operations tab and the executeDefault method that takes a String argument and press invoke. This will provide you with a dialog with push buttons for the arguments. In this case a single button with the label String. Press the String button and fill out the command. For example, print_exceptions stacktraces=true.

print_traces

Press Ok on both of the dialogs and exception profiling should now be enabled. To turn it off again, just invoke the operation again and enter print_exceptions exceptions=false, analogously with how you would use jrcmd.

An even easier way for Oracle employees is to pick up a recent internal build of JRockit and use the Diagnostic Command tab in the JRockit Management Console. :) Soon coming to a JRockit near you!

August 13, 2008

JRockit Mission Control at Oracle Open World 2008

This year JRockit Mission Control will be represented at Oracle Open World! I'll have one session and three hands-on labs.

The preliminary schedule is as follows:

Date: 2008-09-21

Hands-On Lab: Diagnostics with Oracle JRockit Mission Control

Session ID: S299540
Track: Oracle Develop: Java
Room: Golden Gate B2
Start Time: 13:15


Date: 2008-09-22

Hands-On Lab: Diagnostics with Oracle JRockit Mission Control

Session ID: S299540
Track: Oracle Develop: Java
Room: Golden Gate B2
Start Time: 16:00


Date: 2008-09-23

Nonintrusive Profiling and Diagnostics with Oracle JRockit Mission Control

Session ID: S299518
Track: Oracle Develop: Java
Room: Nob Hill AB
Start Time: 13:00

Hands-On Lab: Diagnostics with Oracle JRockit Mission Control

Session ID: S299540
Track: Oracle Develop: Java
Room: Golden Gate B2
Start Time: 16:00


I'm looking forward to seeing you there! :)

August 4, 2008

Oracle JRockit Mission Control 3.0.3 available!

The next version of JRockit Mission Control just went live! Feature-wise it is only a minor upgrade, I will go into detail about the most exciting one in a bit, but there are some other changes to this release that are quite profound.

The, in my humble opinion, greatest change is that all JRockit Mission Control features are available by default. There is no need to dabble with licenses. Everything is free to use for evaluation, which among other things means that you can now try out the latency analyzer properly.

JRockit Mission Control has also been relocated to a new homepage at OTN, located at http://www.oracle.com/technology/products/jrockit/missioncontrol/index.html. The next few days a lot of new JRockit Mission Control related material will be posted there.

The update site has moved as well, and can now be found at http://www.oracle.com/technology/software/products/jrockit/missioncontrol/updates/eclipse-3.3/jrmc/.

As you will undoubtedly notice, everything has also been re-branded.

Now, the cool new feature is actually a JRockit JVM side upgrade, that will be automatically picked up by the JRockit Mission Control client. It is now possible to do very cheap memory allocation profiling using the JRockit Latency Analyzer.

There is a new type of latency events available in the latency recordings. They are triggered whenever the JRockit JVM needs to acquire a new Thread Local Area or whenever the JRockit JVM needs to allocate a new large object. These events provides a good approximation to what is causing the most pressure on the memory system. This means that it is quite easy to find out where to start optimizing allocation behaviour using JRMC LAT.

Here is an example:

  1. First select the JVM you wish to start a JRA recording on. 
    start_recording
  2. In the JRA recording wizard, ensure that you start a JRA recording with latency information in it.
    You can for example use the Latency Recording Template. 
    latency_wizard
  3. Then open the Latency Log tab and open a histogram over the events.
    Make the histogram over the Object Allocation - Class Name property by selecting it in the second combo box. 
    histogram  
    Note: since the allocation events aren't recognized yet as being from the standard producer, you may need to enable them in the event palette to the left.

    As you can see, most of the pressure on the memory system seems to be from the allocations of Strings. This is not uncommon. Together with arrays of primitive types, Strings are quite commonly high ranking here.
  4. Now right click on the String row in the table, and set the operative set to the events corresponding to that row.
    The selected event property will unfortunately be reset, which will cause the histogram to be reset as well, but never mind that.
  5. Move over to the Latency Traces view and check that you only want to see the events in the operative set. 
    traces   You can now clearly see exactly where you should focus your efforts to reduce the amount of String allocation to reduce the pressure on the memory system.

Reducing the pressure on the memory system leads to less frequent garbage collections and thus a more responsive system.


For more information on the JRockit JVM R27.6 release, please have a look at the release notes.

Running Eclipse/Workshop on JRockit! (Migrated from the old BEA blog)

Within the next few days, Mission Control will be available for download directly into your IDE from an update site.  To fully take advantage of this, however, you need to run Eclipse on a JRockit. This blog is an update to an old blog of mine, which explains how and has a few very specific tips for the insanely rich or the ones working for BEA. ;)

Despite JRockit being an outspoken server side JVM, many long running client applications, like IDE's, actually run very well on JRockit. Running Eclipse on JRockit is no exception.

The easiest way to change the JVM on which to start Eclipse is by modifying the eclipse.ini file. You can also set the -vm on the command line used to start Eclipse. In windows you'd typically do that in the shortcut you use to launch Eclipse. Just using JRockit out of the box yields pretty good performance. Here is an example ini file:

-showsplash
org.eclipse.platform
-vm
D:\jrockits\R27.5.0_R27.5.0-111_1.5.0\bin\javaw.exe

You can usually get better performance by setting the initial heap size and the max heapsize to the same, thus bypassing the dynamic growing/shrinking of the heap:

-showsplash
org.eclipse.platform
-vm
D:\jrockits\R27.5.0_R27.5.0-110_1.5.0\bin\javaw.exe
-vmargs
-Xms384m
-Xmx384m

The insanely rich (or BEA employees) can run Eclipse on WLRT/deterministic GC (some would call this overkill) for a very smooth experience. This is the eclipse.ini I use myself:

-showsplash
org.eclipse.platform
-vm
D:\jrockits\R27.5.0_R27.5.0-110_1.5.0\bin\javaw.exe
-vmargs
-Xms384m
-Xmx384m
-XgcPrio:deterministic
-XpauseTarget:20
-XXcompactratio:1

One common pitfall is trying to use Sun specific flags, which would cause the JRockit launcher to exit right away, like for example -Xincgc or -Xbatch.

 

For more information: