Understanding Iterations
An Iteration defines the individual scenario performed during a round. The iteration mode controls how the iteration operates.
Key Attributes of an Iteration
- Name: Identifier for the iteration.
- HTTP Request: Configuration for the request, including the method, URL, headers, and payload.
- Mode: Defines how the iteration operates (see Iteration Modes).
- Startup Delay: Optional delay before starting the iteration.
- MaximizeThroughput: Set
maximizeThroughput: trueto push send-rate as fast as other constraints allow. Maximizing the throughput will result in higher CPU and Memory usage
Structure
- The plan is at the document root (no
plan:key). - Rounds are required; each round contains one or more iterations.
- Each iteration typically contains an httpRequest.
Iteration Features
SkipIf
The skipIf property allows conditional execution of an iteration. If the condition evaluates to true, the iteration will be skipped. Conditions can use Flee expressions and may reference session/global variables, placeholders, and metrics.
Example use cases:
- Skip login attempts if login failed to get a response.
- Skip requests when a certain error condition has been met.
skipIf: ${LoginResponse.StatusCode} = 401
skipIf: ${LoginResponse.Body.token} = ""
skipIf: ${Metrics.Load.Heavy.Duration.P90ResponseTime} > 250
Failure Rules
⚠️ Breaking Change: The old failureCriteria property with individual threshold fields (maxErrorRate, maxP90, maxP50, maxP10, maxAvg, errorStatusCodes) has been permanently removed as of version 3.0.2.6. The last version supporting the old format was 3.0.2.5. Please migrate to the new failureRules format described below.
The failureRules property defines rules that are applied after the iteration finishes. These rules classify the outcome of the iteration as either Failed or Success. This is useful for reporting and post-run analysis.
failureRules:
- metric: "ErrorRate > 0.10"
errorStatusCodes: ">= 500"
- metric: "TotalTime.P90 > 250"
- metric: "TotalTime.P50 > 200"
- metric: "TotalTime.Avg > 180"
CLI Usage
lps --url https://example.com -rc 1000 --failurerule "ErrorRate > 0.05;>= 500" --failurerule "TotalTime.P90 > 250"
Format: "metric[;errorStatusCodes]"
Termination Rules
⚠️ Breaking Change: The old terminationRules format with individual threshold fields (maxErrorRate, maxP90, maxP50, errorStatusCodes) has been permanently removed as of version 3.0.2.6. Please migrate to the new format described below.
The terminationRules property lets you define real-time termination conditions for an iteration. These rules are evaluated continuously by the Master node (aggregating all workers). An iteration will be terminated only if a rule is continuously violated for the entire grace period.
terminationRules:
- metric: "ErrorRate > 0.2"
errorStatusCodes: ">= 500"
gracePeriod: "00:00:10"
- metric: "TotalTime.P90 > 200"
gracePeriod: "00:00:05"
- metric: "TotalTime.P50 > 400"
gracePeriod: "00:00:15"
CLI Usage
lps --url https://example.com -rc 1000 --terminationrule "ErrorRate > 0.10;00:05:00;>= 500" --terminationrule "TotalTime.P90 > 500;00:00:30"
Format: "metric;gracePeriod[;errorStatusCodes]"
Metric Expression Reference
Both failureRules and terminationRules use the same inline metric expression format.
Expression Format
MetricName[.Statistic] Operator Threshold
Supported Metrics
| Metric | Aliases | Statistics | Description |
|---|---|---|---|
ErrorRate | - | (none) | Percentage of failed requests |
Throughput | RPS, RequestsPerSecond | (none) | Requests per second |
TotalTime | - | .P50, .P90, .P95, .P99, .Avg, .Min, .Max | Total request duration |
TTFB | TimeToFirstByte | .P50, .P90, .P95, .P99, .Avg, .Min, .Max | Time to first byte received |
WaitingTime | Waiting | .P50, .P90, .P95, .P99, .Avg, .Min, .Max | Server processing time |
TCPHandshake | TCP | .P50, .P90, .P95, .P99, .Avg, .Min, .Max | TCP connection handshake time |
TLSHandshake | TLS, SSL | .P50, .P90, .P95, .P99, .Avg, .Min, .Max | TLS/SSL handshake time |
Supported Operators
| Operator | Description | Example |
|---|---|---|
> | Greater than | "ErrorRate > 0.05" |
>= | Greater than or equal | "TotalTime.P90 >= 500" |
< | Less than | "Throughput < 100" |
<= | Less than or equal | "TotalTime.Avg <= 200" |
= | Equal | "ErrorRate = 0" |
!= | Not equal | "ErrorRate != 0" |
between X and Y | Range (inclusive) | "TotalTime.P90 between 100 and 500" |
Complete Iteration Example
name: IterationFeaturesPlan
rounds:
- name: FeatureRound
numberOfClients: 50
arrivalDelay: 100
runInParallel: false
iterations:
- name: LoginIteration
httpRequest:
url: https://httpbin.org/post
method: POST
headers:
Content-Type: application/json
payload:
raw: |
{ "username": "user", "password": "pass" }
- name: Home
httpRequest:
url: https://httpbin.org/
httpMethod: Get
# SkipIf (iteration)
skipIf: ${LoginResponse.StatusCode} = 401
# Failure Rules (evaluated once the iteration execution is completed)
failureRules:
- metric: "ErrorRate > 0.10"
errorStatusCodes: ">= 400"
- metric: "TotalTime.P90 > 250"
# Termination Rules (evaluated in real-time during execution)
terminationRules:
- metric: "ErrorRate > 0.2"
errorStatusCodes: ">= 400"
gracePeriod: "00:00:03"
- metric: "TotalTime.P90 > 2000"
gracePeriod: "00:00:05"
Global Iterations and References
Iterations can also be defined as global iterations and referenced later within rounds using the reference property. This allows for reusable iteration configurations across multiple rounds.
name: GlobalIterationPlan
iterations:
- name: GlobalIteration
mode: DCB
duration: 300
batchSize: 100
coolDownTime: 1000
httpRequest:
url: https://httpbin.org/headers
httpMethod: GET
httpVersion: 2.0
rounds:
- name: TestRound
numberOfClients: 1
reference: ["GlobalIteration"]