Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: Java Language
Expertise: Beginner
Jan 10, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

To RMI or Not to RMI

We are now developing a Java-based remote monitoring system application for our SCSI RAID subsystem products. This application can enable our customers to monitor the status, and change the configuration, of the SCSI RAID device being monitored. We are using C++ for the SCSI programming part and we are using JNI to interface with the rest of the server side of our application. Should we use RMI for the networking needs of the client and the server, or should we just use simple socket-based networking?

RMI has the advantage of being relatively powerful and easy to program. Remote objects look like local objects and network communication happens transparently when their methods are invoked.

However, RMI also has the disadvantage of being relatively slow and not very fault-tolerant. Remote methods are synchronous, which can freeze applications when the network is down. That makes RMI unsuitable for applications that need to abort communication when stalled.

Although this deficiency can be worked around with the use of threads, it does not possess the flexibility of using sockets with timeouts and non-blocking I/O. Then again, non-blocking I/O is not possible with Java, so this has little bearing.

RMI is more suitable for use in the configuration part of your client application because configuration utilities are not fault-sensitive and have little need for optimized network communication. The monitoring part of your application is very likely unsuitable for use with RMI if it is a constantly running monitoring system that requires some level of real-time information delivery. Using a custom protocol over sockets will yield better results. However, if the monitoring is only single snapshot monitoring, where a user observes the status of the device only occasionally, then RMI is a good implementation approach.

DevX Pro
Thanks for your registration, follow us on our social networks to keep up-to-date