Data-driven load

Traffic modelling

Point a feeder at a dataset and reference its columns with ${data...} — unique users, SKUs or payloads on every iteration instead of the same request over and over.

Browse all 52 demos 12 categories
Run it
$ loadr run examples/05-data-driven.yaml
examples/05-data-driven.yaml
# Data-driven login: each iteration takes the next row from users.csv
# (shared cursor across all VUs, wrapping at EOF).
name: data-driven-login
description: CSV-parameterized login flow

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

data:
  users:
    type: csv
    path: data/users.csv
    mode: shared       # all VUs share one cursor (per_vu: each VU gets its own)
    on_eof: recycle    # wrap around (stop: retire the VU)

scenarios:
  login_flow:
    executor: per-vu-iterations
    vus: 5
    iterations: 20
    flow:
      - request:
          name: login
          method: POST
          url: /login
          body:
            form:
              username: ${data.users.username}
              password: ${data.users.password}
          extract:
            - { type: jsonpath, name: token, expression: "$.token" }
          assert:
            - { type: status, equals: 200 }
            - { type: jsonpath, expression: "$.token", exists: true }
      - request:
          name: profile
          url: /me
          headers:
            Authorization: Bearer ${token}
          checks:
            - { type: status, equals: 200 }
            - { type: jsonpath, name: correct user, expression: "$.username", equals: "${data.users.username}" }

thresholds:
  checks: [ "rate>0.99" ]

View raw: examples/05-data-driven.yaml

Related files: data/users.csv · data/skus.json

What it shows

  • CSV / JSON feeders
  • ${data.<feeder>.<col>} interpolation
  • shared / per-VU / unique consumption modes