I am interested to implement some processes that span over machines i.e. form a distributed program. It is the functionality that these processes provide that I want to distribute and not data.
So what is currently the norm for distributed programming in Java?
Is it still RMI? Or some kind of messaging system?
I originally thought RMI and a little JMX for remote management but would like to know what is the current best practice. Seems like RMI is always "burried" under another layer (e.g. EJBs right?)
Update:
After answers and comment it seems that the current trend is to go for messaging systems? Doesn't this introduce a "centralized" component in a distributed design?
I do not think RMI is the way to go anymore, if RMI is suitable for your task just do it with EJB as you will get many features from the application server such as security/access control, transaction management, database management, etc. implementing those in RMI is painful and waste of time.
Another option for distributed programming is to use GridGain, a powerful framework you can use to easily run your program on a cluster of commodity machines. similarly you might consider Apache Hadoop
I would start with GridGain because it is very easy to install, just unzip and run, and it is also relatively simple to integrate with your application.
Edit
RMI and Messaging system are bit different because the use of synchronous vs. asynchronous communication should depend on the overall system architecture and how different component interact with each other. For example, asynchronous communication might be more suitable when a service invocation takes long time to finish e.g. do batch operation or archive large data. In this case, the service client does not hold system resources (e.g. sockets and threads)
On the other hand, synchronous communication might be more appropriate when the service/function take short time to finish and each remote service depends on the result of the previous one.
I recently used the Cajo project to do remoting among several instances of java desktop (Swing) apps. The project hasn't seen an update in a while, but it's been really easy to use, and just works, with a minimum of fuss.
It's a thin wrapper around RMI, so it's very lightweight, and very fast.
For some examples, see the article "Cajo, the easiest way to accomplish distributed programming in Java"
Best practice is typically EJB, given you run inside an app server/Java EE stack.
I like asynchronous messaging solutions. I.e. using JMS. You could easily set up ActiveMQ as a network of brokers, and then rely on publish subscribe patterns. In that case, there would be no central component. There are other brokers that does this also.
Have you looked at AKKA? It is not anything near a standard, but a nische concept usefull if your application is very distributed in it's nature.
Another trend, perhaps too data centric for you, is to use distributed memory/data grids. Such as hadoop etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With