CS735/CS835
Programming Assignment 4
(due Sun Dec 8)


Design and implement a Java RMI program to act as a communication relay between other programs that are (hypothetically) on opposite sides of a firewall.

Two programs that are on opposite sides of a firewall cannot directly communicate. They must use a program that resides on a relay machine that can communicate with programs on both sides of the firewall. The relay program accepts message data from the source of the message and sends the data on to the destination of the message.

The basic idea is that one client program will perform a remote method call to the relay program to initiate a message to another client program. The relay program will then make a remote method call to the second node to complete the message.

Your relay need only support a very simple message: a byte array. Message destinations can be denoted by a remote object reference for an object that has a method for receiving the byte array on the destination machine.

The client programs will need some mechanism to check-in with the relay program to register and exchange their remote object references. Perhaps the rmiregistry facility can be used for this purpose. Of course, the client programs will also need to obtain a remote object reference for the relay program.

Measure the performance of your relay program by constructing two types of client programs. The first client program should "echo" a fixed size message back and forth between two client machines (using the relay program, of course, as an intermediary) a fixed number of times. This program will allow you to measure the round-trip latency of a relayed message. The second client program should "blast" a fixed number of fixed sized messages from one client machine to a second client machine (also using the relay program as an intermediary). This program will allow you to measure the available bandwidth for relayed messages.

Use the Star Cluster to perform experients.

First, use three distinct machines to host two client programs and a relay program.

When measuring latency, use the following series of message sizes: 10, 1000, 2000, 4000, 8000. Run enough iterations for each message size so that the overall running time is at least a few seconds.

When measuring bandwidth, use increasing message sizes until the maximum bandwidth is obtained. Again run enough iterations for each message size so that the overall running time is at least a few seconds.

Next, use five distinct machines to host four client programs and a relay program. The client programs should be organized as two pairs. Each pair will be simultaneously running either the latency test or the bandwidth test. Repeat the latency and bandwidth experiments.

Finally, construct a second version of the relay program that creates a thread to handle each relay request. The hope is that utilizing multiple threads will allow multiple messages to be simultaneously in transit through the relay. Repeat the experiments using the multithreaded relay to see if this technique provides any improvement in performance.

You should write a laboratory report for this assignment. This report should first document the design of your relay program. Describe the remote methods that you implemented, how exactly a message gets relayed and delivered, and how you initiate the relay. The report should then present and analyze the experimental data that you collect. Plot the latency data on graphs with microseconds on the y-axis and message size on the x-axis. Plot the bandwidth data on graphs with Megabits per second on the y-axis and message size on the x-axis. Be sure to compare your latency and bandwidth numbers to the direct (no relay involved) latency and bandwidth numbers that were presented earlier in the course for the Star Cluster. Attempt to explain any differences that you see. Also be sure to compare the single-threaded and the multithreaded versions of the relay program. Again attempt to explain any differences that you see.

Points will be awarded for this assignment in the following way:

  1. Relay design: 40 points.
  2. Single-threaded relay implementation: 20 points.
  3. Single-threaded latency and bandwidth tests: 20 points.
  4. Multithreaded relay implementation: 10 points.
  5. Multithreaded latency and bandwidth tests: 10 points.
You should submit your report and all your source code to me via e-mail. Please archive the source code using some standard tool that I can process under Linux. Your e-mail message should include information about how I can process your code archive. Your report should be either just "flat" Ascii or Postscript or PDF. (Please do not send me a Microsoft Word document!)

Do ten runs for each data point to try to avoid anomalies. Try to do your timings at "off hours" when the cluster is not heavily in use. (This may require that you not do your work at the last minute!) For your report you should summarize the ten runs. Be sure to explain how you summarized the data and include all the raw data as an appendix to your report or in another file in your submission.

To receive full credit for the assignment, you must submit prior to 8am on Monday December 9. Late submissions will be accepted at the penalty of 5 points per day up to one week late.

Remember: as always you are expected to do your own work on this assignment.

Also: you should adequately document and structure your programs.

And: take care with the writing of your report. Use complete sentences, proper punctuation, etc. Use a spell checker. Most importantly, allocate some time for writing your report. Review and revise as necessary. Your writing will be graded for both clarity and mechanics. Finally, don't forget to include the required analysis in your report.


Last modified on November 11, 2002.

Comments and questions should be directed to pjh@cs.unh.edu