-
Notifications
You must be signed in to change notification settings - Fork 19
Tutorial: Creating a Workload
yungsters edited this page Sep 14, 2010
·
3 revisions
This tutorial will help you create a Rain workload. A basic Rain workload consists of three (3) main components:
- A set of operation classes that can be executed to generate work.
- For a key-value storage-type workload, operations might include
GetOperationandSetOperation. - For an HTTP web application, operations might include
HomePageOperationandLoginOperation.
- For a key-value storage-type workload, operations might include
- A generator class.
- Indexes the operations and contains factory methods for instantiating operations.
- Produces the next operation to execute given the last operation executed.
- Generates the cycle time or think time to use (i.e. delay between operation executions).
- A JSON (JavaScript Object Notation) configuration file.
The workload you want to generate must conform to the following fundamental requirements:
- The target must have a single point of entry (i.e. IP address and port) accessible from a workload server.
- The operations must be transcribable in Java.
The following instructions will be accompanied by examples for creating a workload named example.
- Create a new package:
radlab.rain.workload.example - Copy all of the classes from
radlab.rain.workload.sampletoradlab.rain.workload.example. - Rename
SampleGeneratortoExampleGeneratorandSampleOperationtoExampleOperation. - Modify
Operation1andOperation2to be operations relevant to your workload.- Rename the class to something more descriptive (e.g.
DoNothingOperation). - In the class constructor, change the assignments:
-
_operationName: A name used for logging and result presentation. -
_operationIndex: A unique index (starting from 0) as specified inExampleGenerator. - If the operation must be executed synchronously, set
this._mustBeSync = true;.
-
- Update the factory methods at the bottom of
ExampleGenerator.- Update the switch statement in
ExampleGenerator.getOperation().
- Update the switch statement in
- Implement
execute()to generate requests for your operation.- Take a look in
radlab.rain.utilfor shared utilities (e.g.HttpTransport). - Make use of Rain’s trace capabilities by logging a trace after every request.
- Take a look in
- Implement properties and methods shared by all operations in
ExampleOperation.- Each operation must store enough state necessary to run asynchronously.
-
ExampleOperation.prepare()should be used to assign operation properties.
- Create more operation classes as necessary.
- Rename the class to something more descriptive (e.g.
- Create the JSON configuration files by making copies of the sample JSON files.
-
profiles.config.example.json- Change the track name (i.e. the string keys for the root JSON object).
- Update the generator, behavior, loadProfile, and target.
- Adjust the rest or leave the defaults for now.
-
rain.config.example.json- Change profiles to point to the the file above.
- Adjust the timing as necessary or leave the defaults for now.
-