Hi, I'm new in making distributed applications using Java language.
- Posted by: Jacek Olszak
- Posted on: September 10 2004 14:59 EDT
My question is, which technology should I use: core RMI or JavaSpaces? The project, which I'm making is a simple real-time-strategy game engine. I'm looking for technology, which generate the lowest network traffic. In first phases of my project I was programming using sockets and my own protocol. But it was hard to extend the existing system. So, I've decided to use some higher-level technology like RMI or JavaSpaces (I guess, that EJB is not quite good option).
P.S. Sorry for my terrible english :)
- Performance: RMI vs JavaSpaces by Cameron Purdy on September 13 2004 10:53 EDT
- Performance: RMI vs JavaSpaces by Quartz Quartz on September 15 2004 09:37 EDT
- Performance: RMI vs JavaSpaces by Gad Barnea on September 15 2004 15:52 EDT
Take a look at Coherence .. it provides advanced clustering for managing data, messaging, events, etc.
Coherence: Shared Memories for J2EE Clusters
Having worked with RMI till it I throw up, I must say it has 2 sides:
good: it is removing the protocol burden.
bad: it requires some coding discipline, and is not a fast protocol (invocation stuff)
Having designed many protocols, and having worked with 1.1 applets also, I must say my favorite combination is simple value object serialization over socket.
Serializing removes the burden of data transport. You just concentrate on the communication.
You use hashtable/vector (for 1.1 compatibility) of strings, wrappers, arrays of primitives, etc...
Stay away from non-core objects (avoid your own serializable classes).
I like to write key-value pair in hashtable, because they make the protocol infinitely extensible. Make sure you toss in a version string, just in case.
And that's pretty much it!
There is nothing rmi will do that you can't do with a simple table of properties. Some are command properties (would have been function calls for rmi), some are request/response data properties (rmi args/return values).
Having designed many protocols, and having worked with 1.1 applets also, I must say my favorite combination is simple value object serialization over socket.Serializing removes the burden of data transport.This aproach is the best at least if you want to use the lowest network traffic as possible.
The problem is that both end-points of the communication must be written in Java. If you are planning to write the client-side of the application in a different language, you should try to use web services. SOAP messages are more expensive that serialized object over RMI (they include the data, the tags, and the envelope) but they allow you a lot of interoperatibility.
Jose R. Huerga
Thanks to everyone for your replies! I've finally decided to use Quartz approach, because it use the lowest network traffic as possible (and this was for me the most important thing).
The project website will be available in first days of next month (under address: http://universekingdom.net ). On more time, thanks to everyone for support.
You are making the right choice by looking at proven solutions for distributed applications. I am obviously biased ;-), but I do suggest that you take a look at GigaSpaces @ http://www.gigaspaces.com for unmatched performance in distributed computing.
Don't hesitate to contact me directly if you have any questions GigaSpaces (or high-performance Java in general).
Cheers - Gad
VP Product Marketing