ostore.apps.test
Class TrafficGenerator

java.lang.Object
  |
  +--ostore.apps.test.TrafficGenerator
All Implemented Interfaces:
EventHandlerIF, ProfilableIF, SingleThreadedEventHandlerIF

public class TrafficGenerator
extends Object
implements SingleThreadedEventHandlerIF, EventHandlerIF, ProfilableIF

The TrafficGenerator is a small, simple client that provides a stream of random OceanStore traffic. This traffic can act as a small, incomplete test vector for OceanStore.

Overview of Operation of : After the TrafficGenerator has received the StagesInitializedSignal, it dispatches a request to create the first data object. When the response for that request or any future request is returned, the TrafficGenerator creates zero or more new requests by the following procedure. If there are no more outstanding requests, the TrafficGenerator creates and dispatches another request to prevent the system from quiescing. If the TrafficGenerator still has outstanding requests, it chooses a random number and compares that against a user-provided threshold. If the random number is below the threshold, the TrafficGenerator creates and dispatches another request. After dispatching a request, if the number of outstanding requests has not yet reached the maximum number of outstanding permitted, the TrafficGenerator will repeat the process using a new random number.

The type of traffic created is determined by an array of random number generators and parameters defined in the initialization scripts. If all requested objects have not yet been created, the TrafficGenerator determines randomly whether to submit a create object request or a read/write request. If it has chosen to send a read/write request, it selects a random data object and determines whether to send a read request or a write request. (Obviously, if the data object contains no data, it will first submit an append request.) If it has chosen to send a read request, it creates a read request based on the read distribution parameters provided in the initialization scripts and dispatches the request. If it has chosen to send a write request, the TrafficGenerator the randomly determines whether to send an append update or a replace update. The TrafficGenerator then creates the update based on the write distribution parameters provided in the initialization scripts and dispatches the request.

Initialization Parameters: The behavior of the TrafficGenerator can be controlled by a large number initialization parameters. These parameters and their result are described below.

NumObjects
The number of data objects to create.
MaxObjectSize
The maximum allowed size of a data object. After reaching the maximum size, all other updates to that object will be replace updates.
TotalTraffic
The number of requests to dispatch. After sending this number of requests and receiving their responses, the stage will terminate with an exit code of success.
MaxTrafficRate
The maximum number of outstanding requests permitted.
TrafficRate
An integer, 0 <= TrafficRate <= 100, that represents the probability that the TrafficGenerator will submit another request after receiving a response to an earlier request. If there are no more outstanding requests, a new request will be dispatched regardless of the value of TrafficRate, and if there are MaxTraffic outstanding requests, a new request will not be dispatched. Note, that this parameter is most effective in the range 40 < TrafficRate 60. If the value of TrafficRate is much smaller, the amount of outstanding traffic is almost always very small; if the value of TrafficRate is much greater, the amount of outstanding traffic is almost always MaxTraffic.
CreateRate
An integer, 0 <= CreateRate <= 100, that represents the probability that the TrafficGenerator will, after it has decided to submit a request, create and dispatch a create object request. For example, if CreateRate is set to 3, there is a 3% chance that a create object request will be dispatched. After all objects have been create, the CreateRate is no longer relavant.
ReadRate
An integer, 0 <= ReadRate <= 100, that represents the probability that the TrafficGenerator will, after it has decided to submit a read/update request, create and dispatch a read request. For example, if ReadRate is set to 50, there is a 50% chance that a read request will be dispatched. Note, if ReadRate is set to 100, each data object will be updated exactly once (to append data into the empty object); all other requests will be for reads.
AppendRate
An integer, 0 <= AppendRate <= 100, that represents the probability that the TrafficGenerator will, after it has decided to submit an update request, create and dispatch an append update request. For example, if AppendRate is set to 65, there is a 65% chance that an append update reuqest will be dispatched. Note, if AppendRate is set to 0, each data object will be the object of exactly one append update request (to append data into the empty object); all other update requests will be replace update requests.
RP_Pkeyfile
The full path to a file storing a representation of the responsible party's public key.
Principal_Pkeyfile
The full path to a file storing a representation of the principal's public key.
Principal_Skeyfile
The full path to a file storing a representation of the principal's private (secret) key.
RandomSeed
An integer used to seed the random number generator which seeds other random number generators.
MinTrafficDelay
An integer, 0 <= MinTrafficDelay <= MaxTrafficDelay, that is the minimum delay in milliseconds between traffic events. The traffic delay is uniformly distributed between MinTrafficDelay and MaxTrafficDelay. The default value of MinTrafficDelay is 0 so that events are dispatched as soon as they are created.
MaxTrafficDelay
An integer, 0 <= MinTrafficDelay <= MaxTrafficDelay, that is the maximum delay in milliseconds between traffic events. The traffic delay is uniformly distributed between MinTrafficDelay and MaxTrafficDelay.
The default value of MaxTrafficDelay is 0 so that events are dispatched as soon as they are created.

Version:
$Id: TrafficGenerator.java,v 1.14 2004/05/13 19:42:42 hweather Exp $
Author:
Patrick R. Eaton

Constructor Summary
TrafficGenerator()
           
 
Method Summary
 void destroy()
           
 void handleEvent(QueueElementIF element)
           
 void handleEvents(QueueElementIF[] element_array)
           
 void init(ConfigDataIF config)
           
 int profileSize()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrafficGenerator

public TrafficGenerator()
Method Detail

handleEvent

public void handleEvent(QueueElementIF element)
                 throws EventHandlerException
Specified by:
handleEvent in interface EventHandlerIF
EventHandlerException

handleEvents

public void handleEvents(QueueElementIF[] element_array)
                  throws EventHandlerException
Specified by:
handleEvents in interface EventHandlerIF
EventHandlerException

init

public void init(ConfigDataIF config)
          throws Exception
Specified by:
init in interface EventHandlerIF
Exception

destroy

public void destroy()
             throws Exception
Specified by:
destroy in interface EventHandlerIF
Exception

profileSize

public int profileSize()
Specified by:
profileSize in interface ProfilableIF