-
Notifications
You must be signed in to change notification settings - Fork 10
v3.5 Scenarios
-
Introduction
-
Syntax
-
Configuration
3.1. Inheritance
3.2. Overriding
3.3. Values Substitution
-
Step Types
4.1. External Command
4.2. Load
4.3. Precondition
4.4. Composite
4.4.1. Sequential
4.4.2. Parallel
4.4.3. Loop
4.4.3.1. By Count
4.4.3.2. By Range
4.4.3.3. By Sequence
4.4.3.4. Infinite
4.5. Mixed Load
4.5.1. Weighted Load
4.6. Chain Load
4.6.1. Delay Between Operations
-
Scenarios Validation
Mongoose supports custom user scenarios. Currently it supports the JSON based scenarios syntax which is described in this document.
Basically, the scenario describes a tree of steps. Some kind of steps may
include another step either a list of the steps. Each scenario step may
contain its own config
section describing this step configuration.
Mongoose can not run without a scenario. So it uses the default scenario
implicitly if the scenario file to run is not specified obviously. The
file containing the default scenario is located at scenario/default.json
.
The default scenario contents:
{
"type" : "load"
}
To run a custom scenario the following CLI option should be used:
java -jar <MONGOOSE_DIR>/mongoose.jar \
--test-scenario-file=<PATH_TO_JSON_SCENARIO_FILE>
The configuration values from the step's configuration are inherited by all child steps (and possibly overridden).
{
"type" : "sequential",
"config" : {
// the configuration specified here will be inherited by the child steps
"load" : {
"type" : "read"
}
},
"steps" : [
{
// will use the inherited "load-type=read" value
"type" : "load",
},
{
"type" : "load",
"config" : {
"load" : {
// overrides the inherited "load-type=read" value
"type" : "update"
}
}
}
...
]
}
The configuration values from the step's configuration override the default configuration and the CLI options:
{
"type" : "load",
"config" : {
// here are the configuration hierarchy
"test" : {
"step" : {
"id" : "step_0"
}
}
}
}
In the case above doesn't matter which test-step-id
CLI option is
specified, the value "step_0" will override this.
Inheritance and overriding order:
- Configuration loaded from
config/defaults.json
- Override with CLI arguments.
- Override with the parent (composite) step configuration values.
- Override with the current step configuration values.
Values substitution allows to parameterize the scenarios using environment variables. The environment variables values should be referred "${<ENV_VAR_NAME>}" in the scenario.
{
"type" : "load",
"config" : {
"item" : {
"data" : {
"size" : "${ITEM_DATA_SIZE}"
},
"output" : {
"path" : "${ITEM_OUTPUT_PATH}"
},
"input" : {
"file" : "${ITEM_INPUT_FILE}"
}
},
"load" : {
"type" : "${LOAD_TYPE}",
"limit" : {
"concurrency" : "${STORAGE_DRIVER_CONCURRENCY}"
}
}
}
}
Then the commands to run this scenario may look like:
export ITEM_OUTPUT_PATH=bucket1
export ITEM_INPUT_FILE=items.csv
export STORAGE_DRIVER_CONCURRENCY=100
export ITEM_DATA_SIZE=1KB
export LOAD_TYPE=create
java -jar mongoose-3.5.1/mongoose.jar \
--scenario-file=mongoose-3.5.1/scenario/misc/env-vars-substitution.json
Quick reference table
Type | Description | Mandatory | Optional |
---|---|---|---|
command | Execute the external command | type, value | blocking |
load | Execute the load operations | type | config |
precondition | Same as "load" but w/o persistent metrics output | type | config |
sequential | Execute the child steps sequentially | type, steps | config |
parallel | Execute the chile step in parallel | type, steps | config |
for | Execute the child steps sequence multiple times in a loop | type, steps | config, value, in |
mixed | Execute the load operations of different kinds | type | config |
chain | Execute the chain of the load operations | type | config |
The step allows to execute the external commands.
{
"type" : "command",
"value" : "sleep 10"
}
The step executes in the blocking manner by default. To execute the command asynchronously (don't wait for its finish):
{
"type" : "command",
"value" : "find /",
"blocking" : false
}
Executes the load operations on the storage. A load step also produces the metrics as a result.
The example of the typical load step configuration is below:
{
"type" : "load",
"config" : {
"item" : {
"input" : {
"file" : "items2read.csv"
}
},
"load" : {
"type" : "read"
},
"storage" : {
"auth" : {
"uid" : "user1",
"secret" : "**********",
"token" : "42b16b00b542b16b00b542b16b00b542b16b00b5"
},
"driver" : {
"addrs" : [
"remote-driver-0.com",
"remote-driver-1.com",
"remote-driver-2.com",
"remote-driver-3.com"
],
"remote" : true,
"type" : "atmos"
},
"load" : {
"generator" : {
"recycle" : {
"enabled" : true
}
},
"limit" : {
"concurrency" : 1000
}
},
"net" : {
"node" : {
"addrs" : [
"storage-node-0.com",
"storage-node-1.com",
"storage-node-2.com",
"storage-node-3.com"
],
"port" : 8080
}
},
"test" : {
"step" : {
"limit" : {
"time" : "10m"
}
}
}
}
}
}
Deprecated. Use the output configuration options to control the metrics output for a load step.
Composite scenario steps include child steps. Any composite step should
have steps
node with an array of the child steps.
Executes the child steps sequentially
{
"type" : "sequential",
"steps" : [
{
"type" : "load",
...
},
{
"type" : "command",
...
}
...
]
}
Executes the child steps in parallel
{
"type" : "parallel",
"steps" : [
{
"type" : "sequential",
...
},
{
"type" : "chain",
...
}
...
]
}
Executes the child steps multiple times sequentially. The loop
conditions are controlled by value
and in
nodes.
Only value
node is present and set to an integer number > 0.
{
"type" : "for",
"value" : 10,
"steps" : [
{
"type" : "load"
}
]
}
-
value
is set to a name of the counter. -
in
is set to a range expression ("-," or "<START_INT>-<END_INT>").
{
"type" : "for",
"value" : "i",
"in" : "2.71828182846-3.1415926,0.1",
"steps" : [
{
"type" : "command",
"value" : "echo ${i}"
}
]
}
-
value
is set to a name of the parameter. -
in
is set to an array of parameter values.
{
"type" : "for",
"value" : "concurrency",
"in" : [
1, 10, 100, 1000, 10000, 100000
],
"config" : {
"load" : {
"limit" : {
"concurrency" : "${concurrency}"
}
}
},
"steps" : [
{
"type" : "load"
}
]
}
Nor value
neither in
nodes are set.
{
"type" : "for",
"steps" : [
{
"type" : "load"
}
]
}
Executes different kinds of the I/O tasks (produced by different load generators) using the shared load controller. Using the same load controller allows to set the shared step limits, step id, etc.
List of the shared options:
- item-output-file
- load-batch-size
- load-rate-limit
- load-queue-size
- test-step-id
- test-step-limit-count
- test-step-limit-fail-count
- test-step-limit-fail-rate
- test-step-limit-size
- test-step-limit-time
Example:
{
"type" : "mixed",
"config" : [
{
// shared options
"item" : {
"output" : {
"file" : "mixed-load-42-output-items.csv"
}
},
"test" : {
"step" : {
"id" : "mixed-load-42",
"limit" : {
"count" : 1000000
}
}
},
// 1st operation kind config
...
},
{
// 2nd operation kind config
...
},
{
// 3rd operation kind config
...
}
]
}
Weighted load is the extension of the mixed load. Additional node weights
specifies the integer
weights for each kind of operations.
{
"type" : "mixed",
"weights" : [
20, 80
],
"config" : [
// create, weight = 20%
{
"item" : {
"data" : {
"size" : "4KB-16KB"
}
},
"test" : {
"step" : {
"limit" : {
"time" : "90s"
}
}
}
},
// read, weight = 80%
{
"item" : {
"input" : {
"file" : "weighted-load-items2read.csv"
}
},
"load" : {
"circular" : true,
"type" : "read"
}
}
]
}
Executes a sequence of the load operations for each item independently. This means that, for example to read the created items it's not necessary to wait until the load step for create load type is finished. Each item is read/updated/etc as soon as possible after it has been created. It should be useful to test if the item is readable from one set of the nodes of a distributed storage after it is created somewhere on the other set of the nodes.
List of the shared options:
- item-output-file
- test-step-id
- test-step-limit-time
{
"type" : "chain",
"config" : [
{
"item" : {
"output" : {
"path" : "/bucket1"
}
},
"storage" : {
"net" : {
"node" : {
"addrs" : "10.123.45.67"
}
}
}
},
{
"load" : {
"type" : "read"
},
"storage" : {
"net" : {
"node" : {
"addrs" : "10.123.45.68"
}
}
}
}
]
}
The item-output-delay
option allows to set a minimal time before the
next operation is performed.
{
"type" : "chain",
"config" : [
{
"item" : {
"output" : {
"delay" : "1m",
"path" : "/default"
}
},
"storage" : {
"net" : {
"node" : {
"addrs" : [
"10.123.45.67",
"10.123.45.68",
"10.123.45.69",
"10.123.45.70"
]
}
}
}
},
{
"load" : {
"type" : "read"
},
"storage" : {
"net" : {
"node" : {
"addrs" : [
"10.234.56.78",
"10.234.56.79",
"10.234.56.80",
"10.244.56.81"
]
}
}
}
}
]
}
Note
- Minimum delay is 1 second, 0 value means no delay.
- In the distributed mode the system clocks should be synchronized precisely.
There are a JSON schema file in the distribution: scenario/scenario-schema.json
.
An user may automatically validate the scenarios using this schema.
This should help to write one's own custom scenario correctly.
- Overview
- Deployment
- User Guide
- Troubleshooting
- Reference