Logo of the Java RMI Plug-in for Eclipse

RMI Plug-in for Eclipse
version 2.0

RMI Spy - Advanced method calls information


The RMI Spy can display lots of in-depth information about the RMI activity of your Java application. The advanced RMI Spy features require your application to run using either JDK 5.0 or JDK 6.0. If you use an earlier JDK, these features will be automatically disabled.

How long does it take to make a remote call?

The call duration is one of the most interesting things to know about your application's RMI behavior. The RMI Spy can display the call duration for both outgoing (client) and incoming (server) method calls. For client calls the measured time includes the initial connection setup time and in both cases the measured time includes both data serialization (or deserialization) time and the method execution time:

How much does serialization cost?

Usually you pass some data as arguments of the remote call. If the arguments are not primitives or remote objects, they are transferred to the other size using serialization. Serialization is an expensive feature, both because of the time it takes to serialize (and then deserialize) an object and because of the necessary overhead headers data. The transfer of the arguments to the other size can be the most significant part of the total execution time of the remote call. If the arguments are simple types (for example strings), you can usually estimate the size of the serialized data, but if the objects are a bit more complex (let's say a HashMap), it's much harder to make an educated guess.

With RMI Spy, there is no need to guess. For each method call, either outgoing or incoming, you can see the total serialization size (in bytes) of both the method arguments and the return value. The details pane (shown later) presents a "by argument" breakdown of the total serialization size.

The displayed values can be wrong by a few bytes if some of the arguments are primitives.

Inspecting the actual argument values in the details pane

The details pane displays lots of interesting information about each remote call. As an example let's take a look at an advanced submitJob() method that has the following signature:

int submitJob(URL source, String header, int priority);

This new method prints a document located at the URL parameter using the header and priority values also provided as method argument. The return value is an integer that represents the job id. The method is called with the following arguments:

int jobID = printer.submitJob(
        new URL("http://www.genady.net/rmi/v20/docs/"), 
        "RMI Plug-in v2.0 docs", 7);

Let's see how such method call is described in the details pane:

The arguments and the return value lines were highlighted by yellow background. For each argument, its actual class is displayed (java.lang.URL in our case). Clicking the underlined class name will open the class in the Java editor. Then we have the actual values highlighted by a reddish background. The actual values will only be displayed for primitives and simple java types that can be easily converted to a string (if there is a simple type that is not currently logged by the RMI Spy, you can request its addition for the next version update). An additional restriction is that only the first 1,000 characters will be logged. Finally, the blue background highlights the serialization size for each argument and the returned value as well as the total method call time. Thise values are best effort estimates, but may include some headers or incorrectly report the serialization size of Java proimitives. A complete stack trace is available if you scroll down the details pane.

Highlighting

Now that we know how long does it take to call a method and how much data is transferred during a method call, it's natural to want to highlight the methods that are possible performance bottlenecks. In order to highlight such method calls press the highlight button () on the view's toolbar. The following dialog will open

It is possible to highlight method calls according to either the time/data transfer measurements or according to both of them. The darkest shade (that corresponds to the highest value) can be either specified in the dialog or it can be dynamically computed as the application runs. The highlighted methods list looks like in the following screenshot:

Disabling the advanced RMI Spy features.

It is possible to disable the gathering of information used by the advanced RMI Spy features by checking the "Disable advanced RMI data gathering (even for JDK1.5+)" option in the "RMI Launch" tab of the "Run..." dialog box.


© 2002-18 Genady Beryozkin, rmi-info@genady.net. Read our Privacy policy. Hosted on RimuHosting. Visit Javalobby.