Friday, May 9, 2014

The brokenness of java in the cloud

In the cloud, it's important to be able to do have computers talk to each other and invoke commands on each other. This is called Remote Method Invocation (RMI). By language, I have the following recap:

  • Python works
  • Ruby works
  • Javascript works
  • Java ... makes you work

Java RMI is a godawful mess that should be killed now. RMI is a very simple thing until you let an argument of architects come up with "the best solution" and then it becomes a convoluted mess of edge cases. In it's simplest, RMI involves serializing and deserializing some input parameters and then running some logic, then doing the same with some output parameters... gosh, that almost sounds like HTTP to me (hint, it really IS).

I don't know exactly where things went wrong with java RMI, but there are registries, incantations, and special glyphs you need to paint on your door on alternate Tuesdays to make it work correctly. In python, ruby, and javascript, I can do RMI 15 different ways while drinking a beer and cooking a steak. In java, I repeatedly need to stop, read a book, ask a professor, read the book again, build some custom software to bypass a limitation (like spanning subnets), then ultimately rejoice in the amount of effort I put into my masterful solution.

In some ways, I think dynamic scripting languages scare off hard core engineers because engineers enjoy a good challenge and a lot of things that engineers love to spend time doing become brainlessly simple when using the right tool for the job. Note, this entire post was spawned by trying to get jmeter to coordinate a bunch of remote hosts to run a load test distributed over remote EC2 instances... You'd think this should be an easy task, but it turns out to be more difficult that one might think (mostly due to java RMI limitations).

2 comments:

Anonymous said...

Is there builtin RMI in javascript, Python or Ruby? I think you are comparing apples to oranges.

You should give JGroups, KryoNet or other "newer" systems a try. Of course you can also try JAX-RS or JAX-WS... RMI should not be killed because of backwards compatibility. It's really old and thus impractical in the light of modern approaches.

Anonymous said...

"In the cloud, it's important to be able to do have computers talk to each other and invoke commands on each other. This is called Remote Method Invocation (RMI)."

Where does this come from? I would never have applications communicate with one another through RMI in a cloud deployment. Use a service call (REST). Use messaging queueing and notification. Holy crap, it's statements like these that make our profession look stupid.