tapestry.repairmonitor
Class PatchworkStage

java.lang.Object
  |
  +--tapestry.repairmonitor.PatchworkStage
All Implemented Interfaces:
EventHandlerIF

public class PatchworkStage
extends Object
implements EventHandlerIF

The PatchworkStage code actively collects network statistics for the purpose of optimizing Tapestry routing. It keeps track of these statistics in a PatchworkModel object that implements the tapestry.repairmonitor.Model interface. Other models that clone this model can be constructed by sending a PatchworkDeltaRequestMsg to the stage. The PatchworkDeltaResponseMsg sent back will contain a PatchworkModel.Delta that can be added to the local clone of the model through the model's add_delta function. The stage will also automatically compute a delta periodically and send out a response message, based on the recalc_period tag in the config file.

The configuration file for this stage may contain the following tags:

latency_period: the period of the latency measurements of the stage in in milliseconds, i.e. how often the stage actively collects latency statistics of nodes in the routing table. If this tag is not present, it defaults to a value of 5000 milliseconds. Specify a 0 to never collect latency measurements.

bandwidth_period: the period of the bandwidth measurements of the stage in in milliseconds, i.e. how often the stage actively collects bandiwdth statistics. If this tag is not present, it defaults to a value of 10000 milliseconds. Specify a 0 to never collect bandwidth measurements.

loss_period: the period of the loss measurements of the stage in in milliseconds, i.e. how often the stage actively collects loss statistics. If this tag is not present, it defaults to a value of 1000 milliseconds. Specify a 0 to never collect loss measurements.

type_op and type_factor: These options control how the probing period varies between levels of the routing table. Level 0 of the routing table (neighbors that share only the first digit) are probed with a period type_period, as specified by the above options. The probing period of the nodes in level n of the routing table would be type_period affected by ( type_op type_factor ) n times. type_op can be +, -, *, /, or ^. For example, to specify an exponential dropoff function for the loss measurements, you would set loss_op to * and loss_factor to 2.

recalc_period: the period of recalculation of the PatchworkModel of the stage in in milliseconds. If this tag is not present, it defaults to a value of 20000 milliseconds. Specify a 0 to never automatically recalculate the table.

respond_period: how often responses get sent back to probing peers. Beacons are collected, and acknowledgements are grouped before sent back, to save bandwidth. Specified in milliseconds. If this tag is not present, it defaults to a value of 16000 milliseconds. Specify a 0 to never respond to any beacons.

timeout: the timeout of statistic collection packets in milliseconds. If no acknowledgement is received within this amount of time, the packet is considered lost. If this tag is not present, it defaults to a value of 120000 milliseconds.

optimize_on: set this to true to enable this stage to optimize the routing table. Currently, this only involves checking for 100% packet loss and switching to a backup node as appropriate.

accept_faults: set this to true to allow this stage to be directed to drop probing packets. Then PatchworkFaultMsgs can be sent to it specifying how many or what percentage of packets to drop.

To change the periods of the stage during runtime, send out a PatchworkChangePeriodMsg message, specifying what type of period to change and to what to change it. Change it to 0 to turn that particular period off.

Currently, the statistics collected by this stage per node are:

Latency: the total amount of round-trip delay of sending one packet to the node, in milliseconds. Measured by sending one packet at t1, receiving an acknowledgement at t2, and letting latency = t2 - t1.

Bandwidth: the bottleneck bandwidth between this node and another node, in bytes/milliseconds (or roughly KBytes/sec). Measured using Sender-Based Packet Pair where two packets of exactly the same size are sent at the same time and acknowledgement is received at times s1 and s2, then bandwidth = (size of packet)/(s2 - s1). Current size of packet is 1461 bytes and clock is of millisecond accuracy, so largest measurable bandwidth is 1461 bytes/ms.

Loss: the percentage of packets lost (as determined by acknowledgements from the other node) since measurements were last taken.

Version:
$Id: PatchworkStage.java,v 1.2 2004/05/06 22:34:27 hweather Exp $
Author:
Jeremy Stribling

Constructor Summary
PatchworkStage()
           
 
Method Summary
 void destroy()
          Specified by seda.sandStorm.api.EventHandlerIF
 void handleEvent(QueueElementIF element)
          Specified by seda.sandStorm.api.EventHandlerIF
 void handleEvents(QueueElementIF[] elemarr)
          Specified by seda.sandStorm.api.EventHandlerIF
 void init(ConfigDataIF config)
          Specified by seda.sandStorm.api.EventHandlerIF
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PatchworkStage

public PatchworkStage()
Method Detail

handleEvents

public void handleEvents(QueueElementIF[] elemarr)
                  throws EventHandlerException
Specified by seda.sandStorm.api.EventHandlerIF

Specified by:
handleEvents in interface EventHandlerIF
EventHandlerException

handleEvent

public void handleEvent(QueueElementIF element)
                 throws EventHandlerException
Specified by seda.sandStorm.api.EventHandlerIF

Specified by:
handleEvent in interface EventHandlerIF
EventHandlerException

init

public void init(ConfigDataIF config)
          throws Exception
Specified by seda.sandStorm.api.EventHandlerIF

Specified by:
init in interface EventHandlerIF
Exception

destroy

public void destroy()
Specified by seda.sandStorm.api.EventHandlerIF

Specified by:
destroy in interface EventHandlerIF