Class WorkloadFile
name: orders-peak
broker: amqp://guest:${BROKER_PASSWORD}@localhost:5672
topology:
exchange: orders
queue: orders.new
routingKey: order.created
publishers:
threads: 4
rate: 50000
messageSize: 1024
consumers:
concurrency: 8
prefetch: 100
handlerTime: 1ms
warmup: 10s
runFor: 2m
expect:
throughputAtLeast: 45000
p99Below: 50ms
Secrets do not belong in this file
A workload file is meant to be committed and reviewed — that is most of its value. So
${VAR} is substituted from the environment before parsing, and a password written
literally is a password in your git history.
The broker can come from outside the file
broker is optional here, because --broker can supply it. A file that names no
broker is the right shape for one that is committed and pointed at a different cluster each time
it runs, and refusing it would make the flag able only to override. Missing from both is still an
error: see withBroker(java.lang.String).
Unknown keys are refused
A misspelled prefech: 100 that is silently ignored produces a run with the default
prefetch and a report that says nothing about it. The result looks completely normal and
answers a different question from the one asked.
-
Method Summary
Modifier and TypeMethodDescriptionbrokerUrl(int index) describe()static WorkloadFileReads workload YAML that is already in memory, exactly asread(Path)reads a file.ramp(int index) static WorkloadFileintsize()withBroker(String override) Settles which broker each workload runs against, the command line winning over the file.Makes every workload in the file a ramp, from--ramp start=1000,step=10%,....
-
Method Details
-
read
- Parameters:
path- a.yaml,.ymlor.jsonfile- Returns:
- the workloads in it
-
parseYaml
Reads workload YAML that is already in memory, exactly asread(Path)reads a file.For a tool that edits the file before it exists on disk — the studio's load designer validates what it is about to write with this, so "valid" there means what it means to the command line, rather than to a second parser that agrees most of the time.
- Parameters:
yaml- the workload file's textenvironment- how${VAR}references are resolved- Returns:
- the workloads in it
- Throws:
ConfigException- with a reason somebody can act on, when the file is not valid
-
withRamp
Makes every workload in the file a ramp, from--ramp start=1000,step=10%,....The flag is the
ramp:block written on one line, and goes through the same parser, so the two cannot disagree about what a setting means. Where the file already has a ramp the flag's settings win, key by key.- Parameters:
spec- comma-separatedkey=valuepairs, or null to change nothing- Returns:
- the same file, with ramps
-
workloads
- Returns:
- the workloads, in file order
-
withBroker
Settles which broker each workload runs against, the command line winning over the file.Where the broker comes from cannot be decided while the file is being parsed, because the flag is not in the file. Deciding it there anyway is the bug this method exists to remove:
brokerwas required of the file, so a file written to be pointed at a broker — one committed to a repository that has no business naming somebody's staging cluster — was refused before the flag that supplies the broker was ever looked at. The flag documented as overriding the file could therefore only override, never supply, and in fact did neither: the command line read it and then ran the file's broker regardless.A suite gets the one override for every workload in it. That is the same reading as "overriding the file": the file's brokers are what is being replaced, and replacing some of them would leave a run that is half against one broker and half against another with nothing saying which half is which.
- Parameters:
override- the--brokerURL, or null when the command line did not say- Returns:
- the same workloads, each with the broker it will run against
- Throws:
ConfigException- if a workload is left without a broker from either source
-
brokerUrl
- Parameters:
index- which workload- Returns:
- the broker URL it runs against
- Throws:
ConfigException- if neither the file norwithBroker(java.lang.String)supplied one
-
ramp
- Parameters:
index- which workload- Returns:
- the ramp to run it as, or null when it is a single run
-
size
public int size()- Returns:
- how many workloads this file holds
-
describe
- Returns:
- the resolved configuration, for
--dry-run
-