开发者

Java distributed system

开发者 https://www.devze.com 2023-04-01 13:28 出处:网络
I\'m starting my final year computer science project and I\'m trying to figure out my first steps. For more details you can go to the project page.

I'm starting my final year computer science project and I'm trying to figure out my first steps. For more details you can go to the project page.

Background: Because I have very little experience in distributed systems I basically though how should I face such a challenge. What I came up with is that the system should work as following:

The client sends out a file, or a set of files that contains code to be processed. That code will implement a distributed algorithm interface written by me, a specific class. The server will create an object from the class.That object will be responsible for the algorithm to be run. The server will return the results to the client. (I actually read about RMI later and found it very similar).

Sending out files is basic - common network I/O. The real problem is object creation and using it as the predefined interface in run-time.

Questions:

  1. The challenge that I have presented sounds like a reflection challenge, Is this correct?
  2. Do you have any first tips on how to implement it?

Looking for some distributed systems java technologies I've encountered RMI, TRMI, LINDA, CORBA, JINI and many others. RMI sounds the most appea开发者_运维技巧ling because it's very similar to what I've gathered to be the solution, but it's also old.

  1. What set of libraries do you think will help me complete this task? Remember I'm a computer science student, so complete out of the box solutions will not stick with my professors.
  2. RMI is old, any better solutions out there ?
  3. any comprehensive tutorial on TRMI?

If you find my logic some how faulty, please correct it.

If you have some more tips on the subject that you think that should be discussed feel free to contact me.


There is not enough information for a recommendation of libraries or technologies. So I'd like to concentrate on the "more tips" part of your question ;)

  • Server sends out a file - Usually it's a client that sends a request to a server and the server will create a response. You should follow that convention.
  • file needs to be executed - We can't execute a file. A file may contain some script or binary code that can be executed by an interpreter or computer. Reason for being picky: you have to do something with the content of the file (parsing, compiling, interpreting, linking, ...)
  • files will implement a [...] interface - see above, the files do not implement anything.
  • The client will run the interface - An interface can't be executed or run.
  • return results of the algorithm to the server - Like mentioned above: usually it's a client that would send the file ("request") to a server. The server then would take the file, do some calculations based on the files content and return a result ("response") to the client.

remote method invocation

With RMI we usually have the following scenario: A client wants to call a remote method. The client knows the interface and the server address. The server has an implementation for that interface. Now the client contacts the server and calls the method on that server.

For your project it looks somewhat different: I think the client has an implementation of an algorithm (java source file or compiled class file) and wants to send it to one or more servers. The server shall process the file, execute the algorithm for some input (the slice) and return the result.

RMI may be a candidate for the file transfer but not for (algorithm) method call. A remote method could look like that (assuming we send a java source file):

public Result process(String javaSource, Data data);


You could use this example and send class files for execution (you can store the class files on disk, and then load them using the URLClassLoader. If you don't want to write on disk, McDowell has a suggestion).

As for communication, there are a LOT to choose from. One thing you could think about is whether to make the message passing synchronous or asynchronous. There is nothing wrong about synchronous messaging (like RMI), but you may want to look for asynchronous solutions as well as they are supposed to be "hot" recently. Or you could just go with your own protocol on top of HTTP or something like that.

One fun exercise would be to distribute data among nodes and execute the algorithm against these distributed data, and then combine the results. In this case the user will specify two algorithms. One that generates data, and one that aggregates the result.


Please also look in to SOAP based web services.. MTOM provides a way to more efficient transfer binary content.

Thanks..

0

精彩评论

暂无评论...
验证码 换一张
取 消