Spring Book – Chapter 18 – Remoting

Comparison between Remoting Technologies

Table 19-1 provides a comparison between various remoting technologies supported by Spring.

Table 19-1. Comparison of various remoting technologies supported by Spring

Technology Protocol Serialization Mechanism Java-Java
RMI RMI Java Standard Yes
HttpInvoker HTTP Java Standard Yes
Hessian HTTP Custom Yes
Burlap HTTP Custom Yes

How to Choose a Remoting Protocol

Some recommendations (could be opinionated), according to the environment in which spring remoting to be used can be summarized as below:

  • If Spring is running on both client and server, using Spring’s HttpInvoker is ideal.
  • If remoting is required in the Java environment without web server being used, using Java’s RMI is the best.
  • If you need to interoperate with other languages using HTTP protocol, using Hessian is ideal.
  • If you need to interoperate with other languages other than HTTP protocol, using RMI over IIOP (CORBA) is recommended.
  • If you would like to access services which are not under your control, using document based messaging in the form of web services promotes loose coupling and is the best way.

If you are looking to choose remoting technologies based on performance, there have been number of studies on this, with their conclusions summarized as follows:

  • The binary protocols (RMI, HttpInvoker and Hessian) are always faster than the XML-based protocols (Burlap).
  • Performance is pretty even amongst the binary protocols, except for Hessian, which performs well only when compared to the XML-based protocols.
  • Native RMI and Hessian have the best performance until the remote method invocations start returning larger lists, at which point native RMI takes a slight lead.
  • It is seen that standard RMI is fast, compared to standard RMI with HTTP tunneling enabled.

HTTP Tunneling is a technique by which communications performed using various network protocols are encapsulated using the HTTP protocol, the network protocols in question usually belonging to the TCP/IP family of protocols. The HTTP protocol therefore acts as a wrapper for a channel that the network protocol being tunneled uses to communicate.

– wikipedia.org

Note: In the same context, here’s a comparison between Spring Web Service and Spring remoting: Spring Web Services is a dedicated Spring Project (using Spring’s own Web Service technology), whereas Spring Remoting is a common approach of integrating different third party remoting technologies in your Spring application. Spring-WS is always contract-first, while Spring Remoting is often code-first.

Summary

Spring supports various remoting strategies and can expose same service under multiple protocols (at different URLs). It provides consistent usage and configuration style using proxies with plain Java service interfaces and exporters for existing Spring-managed beans. Remoting technologies like Hessian, Burlap and HttpInvoker focuses on Java-to-Java remoting. They have simple exposure via web application and also doesn’t require external registry of services.

SOAP via JAX-RPC / Axis can be used for platform-independent remoting. More favorable for Java and .NET and has exposure via web application but setup can be complex in nature. However, Hessian or HttpInvoker provides faster and easier to set up. It can be used to expose your services to multiple protocols for different clients.

After going through this Chapter, you should now have a clear picture of the various concepts in remoting as well as have a clear understanding of various support by the Spring framework to connect your Spring application to various remoting technologies.

Page Visitors: 3856

The following two tabs change content below.
Tomcy John

Tomcy John

Blogger & Author at javacodebook
He is an Enterprise Java Specialist holding a degree in Engineering (B-Tech) with over 10 years of experience in several industries. He's currently working as Principal Architect at Emirates Group IT since 2005. Prior to this he has worked with Oracle Corporation and Ernst & Young. His main specialization is on various web technologies and acts as chief mentor and Architect to facilitate incorporating Spring as Corporate Standard in the organization.
Tomcy John

Latest posts by Tomcy John (see all)

Leave a Reply

Your email address will not be published. Required fields are marked *