Table of Contents

Summary

In this lesson we will implement the best effort broadcast (beb) protocol and the lazy reliable broadcast (lrb) protocol in APPIA.

Objectives

The forth laboratory has the following objectives:

* Create the first protocol (which sends events) in APPIA
* Understand session variables in APPIA

SampleAppl class

The SampleAppl class is an easy interface to load a specific QoS. It has three parameters passed from the command line:

* **Configuration file**: -cf
* **Process Number**: -n
* **QoS**: -qos

The cf parameter is the name of a text file with the information about the set of processes, namely, the processes in the system and, for each of these processes, its "rank" and "endpoint". The configuration file has the following format:

<rank> <host_name> <port>
...
<rank> <host_name> <port>

The process number indicates which is the process which is being started.

The QoS property indicates which is QoS used for the process.

Running

Part 1 - Understand the Best Effort Broadcast Module

Run the following commands. Use a different console for each client and server (5 consoles in total):

1. Observe the getChannel and getBebChannel methods in SampleAppl class. Notice where the BEB qos is created. Take notice of the layers of this QoS.

2. Just looking at the Layer java classes try to understand the events provided, required and accepted by the layers in the QoS.

3. Open the BasicBroadcastSession class. Note how events are being sent and received.

4. Try running an example with three nodes. On three terminals run::

java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 0 -qos beb
java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 1 -qos beb
java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 2 -qos beb

5. Send messages between nodes and note the results.

6. Create a new layer which after counting 5 sendableEvents passing through it **downward**, exits the java application (System.exit).

7. Install this new layer between the TCPCompleteLayer and BasicBroadcastLayer and repeat the tests. Does every node still receive the broadcast event? Is this consistent?

Part 2 - Implement lazy reliable broadcast

Implement a lazy reliable broadcast. This layer requires the BestEffortBroadcast. Whenever it notices that a node has failed (With a perfect failure detector) it rebroadcast the messages received from the failed node to all other nodes.

Before implementing the layer, notice how the perfect failure detector works:

1. Start three consoles with the following command (note the qos parameter)

java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 0 -qos lrb
java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 1 -qos lrb
java -cp .:build:lib/appia-core-4.1.2.jar:lib/log4j-1.2.14.jar tfsd.SampleAppl -f conf/process1.conf -n 2 -qos lrb

2. In each console start the PFDetector with command startpfd. Then kill a node and notice the messages.

3. Now implement the LazyReliable Protocol. This consist on completing the LazyRBSession class. Remember that when a node fails, each node possessing this information resends all messages it has received from the failing node.
Date:2015-03-19
Version:2