Spike test

Load profiles

A ramping arrival rate slams the target from a quiet baseline to a 10× spike and back, then verifies recovery. An abort_on_fail threshold kills the run early if the error rate blows past your limit.

Browse all 52 demos 12 categories
Run it
$ loadr run examples/04-spike-test.yaml
examples/04-spike-test.yaml
# Spike test with a ramping arrival rate: calm baseline, sudden 10x spike,
# recovery. The abort threshold kills the run if errors explode.
name: spike-test
description: baseline -> 10x spike -> recovery

defaults:
  http:
    base_url: https://api.example.com

scenarios:
  spike:
    executor: ramping-arrival-rate
    start_rate: 20
    time_unit: 1s
    pre_allocated_vus: 100
    max_vus: 500
    stages:
      - { duration: 2m, target: 20 }    # baseline
      - { duration: 10s, target: 200 }  # spike!
      - { duration: 1m, target: 200 }   # sustained spike
      - { duration: 10s, target: 20 }   # recover
      - { duration: 2m, target: 20 }    # verify recovery
    flow:
      - request:
          name: checkout
          method: POST
          url: /checkout
          body:
            json: { sku: "A-1", qty: 1 }
          checks:
            - { type: status, one_of: [200, 201] }

thresholds:
  http_req_failed:
    - { threshold: "rate<0.05", abort_on_fail: true, delay_abort_eval: 30s }
  http_req_duration: [ "p(95)<2000" ]

View raw: examples/04-spike-test.yaml

What it shows

  • ramping-arrival-rate for a sharp spike
  • abort_on_fail + delay_abort_eval stop a doomed run
  • Recovery stages prove the service comes back

Key metrics: http_req_failed · http_req_duration.

Load profile · spike