» Back to table of contents

diagnosing vbj performance problems

Below is information on how to diagnose and alleviate several VBJ performance problems.

To diagnose VBJ performance problems, run your program with java -verbosegc. Generally, the JVM should initiate garbage collections after several minutes or longer. If you are seeing garbage collections which occur many times per minute, you can benefit by modifying the defaults provided with VBJ.

The ORB creates a separate GarbageCollector thread that runs every 30 seconds by default. This thread is responsible for maintaining various ORB data, specifically, weak references. The thread calls System.gc() each time it runs. The flags that control this behavior are ORBgcTimeout and ORBsyncGC. The two flags work independently, so both, one, or neither can be specified.

ORBgcTimeout is the waiting time in seconds of the thread. Setting this to a larger number should decrease the frequency of these types of garbage collections. ORBsyncGC can be set to false to prevent the direct call to System.gc(). The GarbageCollector thread will still run but will skip the call to System.gc().

For example: vbj -DORBgcTimeout=300 -DORBsyncGC=false Server

This should decrease the frequency of the GarbageCollector to every five minutes, and eliminate forced System.gc() calls.

The only other time that the ORB might call System.gc() directly is when it catches an OutOfMemoryError when reading a byte array as part of the marshaling process for messages. Seeing this frequently means that you probably have corrupted messages rather than a large data stream. The ORB also prints out a diagnostic message when this occurs: "Forcing garbage collection due to limited memory...".

problem: poor performance when sending messages to a server

A small ORBtcpTimeout setting forces the client to break the current request. The ORBtcpTimeout is used with the underlying socket using the setSoTimeout() method. When using a 200ms value on a test that is a stress test, the client side of the connection breaks out after 200 ms each time a server reply is not received within 200 ms. The exception is remapped to a CORBA.TRANSIENT and caught by the client stub. If the value is increased to 800 ms the problem should occur less frequently. Normally, Inprise advises customers to be very conservative (i.e., use high values, 1000 to 2000 ms, or larger than the anticipated server response time) with this option to catch true anomalies. The alternative, breaking out and resending the request is often much worse than waiting an additional second to see if the server is truly not responding.

Marshaling errors can be a consequence of broken connections. In VBJ, broken connections exposed a thread-related defect on the server side ORB that allowed two threads to modify the same marshal buffer. The problem is more common with native threads. The problem is fixed in VBJ 3.3.1 and VBJ 3.4. In VBJ 3.4, a low value for ORBtcpTimeout may still show InterruptedIOException exceptions whenever the client side ORB breaks out and resends the request, but the server side bug will not result in a marshal buffer corruption.

problem: poor performance when client and server on same machine

If your client and server are on one machine, you may benefit from using the TCP_NODELAY option. We only recommend this if you are on a single machine using the loopback network.

setting vbj properties from within your program

These are example values -- you will want to adjust these to obtain the best performance on your system using the guidelines outlined previously.

// set up some ORBs and BOAs;
orbprops= new java.util.Properties[NumLANs];
orbprops[0]= new java.util.Properties();
orbprops[0].put("ORBtcpTimeout", "2000"); // Send time-out - 2 sec
orbprops[0].put("ORBtcpNoDelay", "true"); // Set TCP_NODELAY
orbprops[0].put("ORBsyncGC", "false"); // No sync GC
orbprops[0].put("ORBgcTimeout", "300"); // 5 minutes, as above
orbprops[1]= new java.util.Properties();
orbprops[1].put("ORBtcpTimeout", "2000");
orbprops[1].put("ORBtcpNoDelay", "true");
orbprops[1].put("ORBsyncGC", "false");
orbprops[0].put("ORBgcTimeout", "86400"); // a bit high - 24 hours

» Please let us know additional information you'd like to see in the programmer's guide.

Java™ and all Java-based trademarks and logos are trademarks or registered trademarks of Sun Microsystems, Inc.. in the U.S. and other countries. Hewlett-Packard is independent of Sun Microsystems, Inc.