Every client/server application will have different remoting requirements, but most criteria will include performance. At the very least, you will want to know how much (if any) performance you are sacrificing for the sake of your other requirements.
In "Java Remoting: Protocol Benchmarks
," Daniel Gredler examined Java's RMI/JRMP, Oracle's ORMI (with and without HTTP tunneling enabled), Spring’s HttpInvoker, Caucho's Hessian, Hessian 2 and Burlap, and three flavors of Apache XML-RPC (Sun-based, HttpClient-based and Lite-based).
The test consisted of remote invocations to a single method which takes an integer size parameter and returns a list of the specified size. The objects in the returned list each contained 10 instance variables (4 strings of about 40 characters each, 2 dates, 1 long, 1 integer, 1 double and 1 float, none of which were null). The lists returned were static, so there was no list construction overhead.
The results of the first 10 invocations were thrown away, in order to allow the VMs to "warm up." The next 100 invocations were tallied and averaged.
The tests were performed on a Windows XP SP2 machine with 2GB of RAM and a 2Ghz Core 2 Duo CPU, using Sun's JVM 1.5.0_09. The client and server were run in two separate VMs on the same host, in order to avoid spurious networking artifacts.
The following library versions were used: Spring 2.0.6, Jetty 6.1.5, OC4J 10.1.3.2.0, slf4j 1.4.3, log4j 1.2.14, Apache XML-RPC 3.1, Commons HttpClient 3.1, and Caucho Hessian 3.1.3.
Spring was used on both the clientside and on the serverside in order to hide the remoting details from the interface consumer and implementor. All serverside components were run inside a single Jetty servlet container, except for the ORMI serverside testing components which were run in OC4J.
Two graphs are included: a "small list" call (250 items or less) and a "large list" call(from 500 to 5000 items). The two graphs are consistent (a good sign for the libraries involved) - and (surprise!) the binary protocols did far better on average than the XML-based protocols.
It's important to note that no general conclusions can be derived from the absolute numbers ... Rather, the numbers must be examined relative to each other.
That said, the following observations may be made:
- The binary protocols (RMI, ORMI, HttpInvoker and Hessian) are always faster than the XML-based protocols (Burlap and the Apache XML-RPC variants) — except for ORMI with HTTP tunneling enabled.
- Performance is pretty even amongst the binary protocols — except for Hessian, which performs well only when compared to the XML-based protocols, and ORMI with HTTP tunneling enabled, which performs on a par with the XML-RPC variants
- Burlap has much better performance than the XML-RPC variants.
- Native RMI and Hessian 2 have the best performance until the remote method invocations start returning larger lists, at which point vanilla ORMI takes a slight lead.
- Changing Apache XML-RPC's transport factory does not seem to have a very large effect on performance.
- It's amazing how fast standard ORMI is, compared to ORMI with HTTP tunneling enabled.
- Hessian 2 bears watching!
Great stuff! That said, it would have been interesting to see SOAP thrown in there, just to see a comparison between XML-RPC and SOAP - one imagines that XML-RPC will dance around SOAP, being a lighter protocol, but it'd be good to have the numbers in hand nonetheless.