Which Java RMI / RPC / IPC technology should I use?

I am developing a Java application that contains a server and a client (there may be multiple clients in the future) that can run on different hosts

For the communication between the two, I currently use a custom protocol, which consists of JSON messages sent through network sockets, and both ends are converted back to Java Bean objects However, the more complex the application, I notice that this approach does not meet my standards and is too complex

I am looking for a perfect and possibly standardized alternative

I've seen RMI, but the protocol is slow (network overhead is high)

The technology I'm looking for should be lightweight (protocol and library wise), robust, and may support compression (if it supports large!), It may support encryption, good documentation and perfect (such as Apache project) It should be as simple as using RMI to call methods on remote objects, but there are no disadvantages

What can you recommend?

Solution

Avro is an Apache project designed for cross language RPC (see thrift for its spiritual predecessor) It is quite new (less than two years), so it is not as perfect as RMI However, you should give it a chance; Large projects like Cassandra are turning to Avro Avro is also a sub project of Hadoop and has been supported by the community

It is designed to be fast and support multiple languages, so you may need to introduce another step during compilation to convert Avro IDL files to Java, although this is not absolutely necessary The rest are typical RPC

One advantage of Avro is that its transport layer is independent of the way data is represented For example, it provides various "transceivers" (their basic communication classes) for raw sockets, HTTP and even local in-process calls HTTPS and SASL transceivers can provide security

In order to represent data, there are various types of encoders and decoders, although the default binaryencoder is usually sufficient, because Hadoop, Cassandra, etc. focus on efficiency If you find it useful, there is also a jsonencoder

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>