Run your first load test

Run a small fanout load test on the in-process pipe with no server, read its JSON result and exit code, and write a run record with -out.

This page takes you from a clone of the repository to a first result in a few minutes. The run starts a server inside the robotelos-load process, so it needs no database, token or container.

Before you start

  • A clone of the repository and the Go toolchain named in go.mod.
  • A shell in the repository root. The commands work in PowerShell and in a POSIX shell.

Run it

go run ./protocol/cmd/robotelos-load -scenario fanout -followers 3 -events 20 -warmup 5

The tool starts a server on an in-memory store, with a mock agent that never answers. It opens one conversation, subscribes 3 followers, sends 5 warm-up events and then 20 measured events 10 ms apart. It prints one JSON document to stdout.

{
  "scenario": "fanout",
  "params": {
    "events": "20",
    "followers": "3",
    "interval": "10ms"
  },
  "seed": 1,
  "env": {
    "go_version": "go1.27.4",
    "os": "linux",
    "cpu": "amd64",
    "gomaxprocs": 8,
    "commit": ""
  },
  "usable": true,
  "steady": {
    "duration_ns": 200000000,
    "events": 20,
    "deliveries": 60,
    "lost": 0,
    "duplicates": 0,
    "reordered": 0,
    "errors": 0,
    "max_schedule_lag_ns": 600000,
    "clamped": 0,
    "percentiles": {
      "p50": 400000,
      "p90": 590000,
      "p95": 630000,
      "p99": 710000,
      "p999": 710000
    },
    "max_ns": 710000
  },
  "server": {
    "robotelos.commands": 26,
    "robotelos.connections": 4,
    "robotelos.connections.active": 4,
    "robotelos.feeds.active": 1,
    "robotelos.journal.events": 28,
    "robotelos.request.duration.count": 33,
    "robotelos.request.duration.sum": 0.003,
    "robotelos.request.size.count": 33,
    "robotelos.request.size.sum": 6362,
    "robotelos.stream.delivery.lag.count": 75,
    "robotelos.stream.delivery.lag.sum": 0.008,
    "robotelos.stream.frames": 75,
    "robotelos.subscriptions.active": 3,
    "robotelos.transport.bytes": 62208
  },
  "process": {
    "cpu_seconds": 0.7,
    "goroutines": 42,
    "heap_bytes": 1935136
  }
}

The numbers above are rounded examples. Yours differ on every run.

Read the result

FieldMeaning
steady.events, steady.deliveriesEvents sent, and events received by all followers. deliveries is events times followers.
steady.lost, duplicates, reordered, errorsMust all be 0. An event a follower never received, received twice, or received out of order, and commands or connections that failed.
steady.percentiles, max_nsDelivery latency in nanoseconds, from the intended send time to the arrival at a follower.
steady.max_schedule_lag_nsThe largest delay between the intended send time and the moment the generator sent.
usabletrue when the generator stayed within 5 ms of its schedule and nothing was lost, repeated, reordered or failed.
serverWhat the server counted over the whole run, set-up and drain included. Present for a server the tool started, or with -metrics-url.
processCPU time, goroutines and heap of the robotelos-load process for the run.

The latency is taken from the intended send time, so a stalled command shows in the events behind it. A generator that falls behind its schedule measures itself, which is why usable exists. Compare only usable runs.

Check the exit code

go run does not pass the exit code of the program on. It exits with 1 for every failure and prints exit status N. To read the real code, build the tool once and run the binary (bin/ is ignored by git):

go build -buildvcs=true -o bin/robotelos-load ./protocol/cmd/robotelos-load
./bin/robotelos-load -scenario fanout -followers 3 -events 20 -warmup 5 > result.json
echo $?

In PowerShell, run .\bin\robotelos-load.exe and read $LASTEXITCODE instead of $?. Without -out, the codes are:

ExitMeaning
0No event was lost, repeated or reordered, no error was counted, and -slo-p99 (if given) was met.
1One of those failed, or the run could not be carried out.
2Bad arguments. -h also exits with 2.

A run whose generator fell behind its schedule still exits 0. It prints a WARNING line on stderr and sets "usable": false. Its numbers are inconclusive, not wrong. To fail a run on latency, add an objective such as -slo-p99 5ms.

Write a run record

Add -out DIR to keep the run as a record:

go run ./protocol/cmd/robotelos-load -scenario fanout -followers 3 -events 20 -warmup 5 -out stress-runs

DIR is relative to your working directory. The tool creates it. Stdout still holds the JSON result. On stderr it prints one line with the verdict and the directory of the record:

run record PASS: /path/to/stress-runs/20260101T120000Z-unknown-fanout-1a2b3c4d

The record is the directory DIR/<run_id>/:

stress-runs/20260101T120000Z-unknown-fanout-1a2b3c4d/
  run.json     the record: verdict, reasons, metrics, target, git, environment
  report.md    the same for a person
  all.txt      one benchmark line per run, for benchstat
  runs/1.json  the full result of the run

With -out the exit code is that of the record, not the table above: 0 PASS, 1 FAIL, 3 INCOMPLETE, 4 TECHNICAL_ERROR, 5 cancelled, 2 bad arguments. Use the built binary to see them. The record of this run is PASS because the server lived in the process and was gone when the record was written. The <run_id> has unknown where the commit goes, because go run did not stamp the build. Build with -buildvcs=true to record the commit; see Judged runs and baselines.

Git ignores stress-runs/ and stress-runs-slowed/. Any other directory name is yours to keep out of a commit.

Try the other transports

Add -transport ws, grpc or sse to measure that binding. With no -url the tool starts a server on 127.0.0.1 for it:

go run ./protocol/cmd/robotelos-load -transport ws -followers 3 -events 20 -warmup 5

Next steps