Termination Rules

This example shows how to stop an iteration in real time when error rate or latency crosses a threshold for a sustained grace period.

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
        terminationRules:
          - metric: "ErrorRate > 0.2"
            errorStatusCodes: ">= 400"
            gracePeriod: "00:00:03"
          - metric: "TotalTime.P90 > 2000"
            gracePeriod: "00:00:05"

What It Demonstrates

  • Live termination based on error rate
  • Live termination based on latency percentile
  • Grace periods to avoid stopping on short spikes

Expression-Based Termination Rule Example

This example shows a termination rule using expression only.

name: TerminationExpressionExample
rounds:
  - name: TerminationRound
    numberOfClients: 100
    arrivalDelay: 100
    iterations:
      - name: SearchIteration
        mode: R
        requestCount: 5
        httpRequest:
          url: https://www.example.com
          method: GET
        terminationRules:
          - expression: '${Metrics.TerminationRound.SearchIteration.Throughput.RPS} <= 40'

What It Demonstrates

  • Expression-only termination rules
  • Immediate termination when the expression evaluates to true
  • Metric path usage from the global Metrics namespace