Scenarios and transports

Choose a load scenario (fanout, many, idle or reconnect) and a transport, set its size, and run it against a server you started or one that is already served.

A scenario is the shape of the load. A transport is the binding the connections use. This page lists what each scenario measures, its flags, and how to point it at a served target.

Before you start

Scenarios

Choose one with -scenario. The default is fanout. A flag a scenario does not use is ignored.

-scenarioShapeFlags it usesWhat it shows
fanoutOne conversation, N followers, one sender at a fixed rate.-followers -events -warmup -interval -drainThe cost of one event per subscriber, and delivery latency.
manyC conversations at once, each with its own sender and followers.-conversations -followers (per conversation) -events -warmup -interval -drainWhat the server pays for the number of conversations.
idleN connections subscribed and silent for -hold, then one probe event.-followers (the connections) -hold -drainWhether idle connections survive. A dropped connection is an error.
reconnectEvery follower drops at once and returns with its old view. -during events were sent while they were gone.-followers -before -during -drainThe catch-up time, whether the server resumed the stream or sent a snapshot.

What each measures:

  • fanout sends numbered events at the -interval, after -warmup events that are sent and checked but not measured. Every follower must see every number once and in order. The latency is from the intended send time to the arrival at each follower.
  • many runs one fanout per conversation at the same time and adds the results. A fault in any group is a fault of the run.
  • idle costs the server a poll, a keepalive and goroutines per connection. The client cannot see that cost, so read it in the server and process parts of the result. The result here says whether the connections lived and how fast the probe arrived.
  • reconnect checks each follower’s final view, not its frames, because a snapshot carries events without frames. Every event must be in the timeline exactly once and in order. The latency in the result is the catch-up time.

The scenario in the result file says many-conversations and reconnect-storm for the last two. The record and the baseline use many and reconnect.

Examples:

go run ./protocol/cmd/robotelos-load -scenario fanout -followers 100 -events 300 -warmup 30 -interval 5ms
go run ./protocol/cmd/robotelos-load -scenario many -conversations 50 -followers 2 -events 100 -interval 10ms
go run ./protocol/cmd/robotelos-load -scenario idle -followers 500 -hold 3s
go run ./protocol/cmd/robotelos-load -scenario reconnect -followers 200 -before 20 -during 50

A bad size is refused before any server starts, with exit 2: -followers, -events and -conversations must be at least 1, -interval above 0, -during at least 1, -before and -hold not negative.

Transports

-transport selects the binding. The default is pipe.

TransportWhat it is-url
pipeThe server and the generator in one process, over an in-memory pipe.Not allowed. It exits with 2.
wsWebSocket.wss://host/v1/ws or ws://127.0.0.1:PORT/v1/ws
sseHTTP with server-sent events.https://host or http://127.0.0.1:PORT
grpcgRPC, always plaintext.127.0.0.1:PORT (host and port, loopback only)

Without -url, ws, sse and grpc start a server inside the process on 127.0.0.1 with random ports. The generator and the server share the process and the CPU. Use this to compare bindings or to test the tool, not to size a deployment.

Numbers from a developer machine are indicative: the generator and an in-process server share the CPU, and a Windows clock steps by about half a millisecond. A baseline is meant for a dedicated Linux host. That run has not been done.

Run against a served target

With -url the tool dials a server that is already running. It reads the bearer token from the environment, never from a flag, so the token does not land in a shell history or a process list.

read -rs ROBOTELOS_LOAD_TOKEN && export ROBOTELOS_LOAD_TOKEN
go run ./protocol/cmd/robotelos-load -transport ws -url ws://127.0.0.1:8787/v1/ws -followers 10 -events 100
$env:ROBOTELOS_LOAD_TOKEN = Read-Host -MaskInput "Token"
go run ./protocol/cmd/robotelos-load -transport ws -url ws://127.0.0.1:8787/v1/ws -followers 10 -events 100

Rules, all checked by the tool:

  • A -url needs a token. With no token it exits with 2 and names the variable.
  • A token goes in plain text to a loopback address only. For another host use wss or https. gRPC is plaintext, so a gRPC target must be on loopback. Otherwise the tool exits with 2. To reach a remote gateway over gRPC, forward its port to your loopback first, for example with an SSH tunnel.
  • The -url belongs to one binding. Give the -transport that matches it.
  • With -out, a token of fewer than 8 bytes is refused with exit 2, because it could not be removed from the record.
  • Against -url, the tool cannot know what the run left behind. A record of such a run is INCOMPLETE unless the target is marked disposable in a target file.

Two flags read the server in another process:

  • -metrics-url is the Prometheus endpoint of the server. It is there when the server runs with OTEL_METRICS_EXPORTER=prometheus. The change over the run goes into server in the result.
  • -pprof-url, -pprof-dir and -pprof-seconds fetch a CPU profile that starts with the run and lasts -pprof-seconds, and a heap and a mutex profile at the end, into -pprof-dir. -pprof-url is the diagnostics listener of the gateway. Keep it on loopback and tunnel to it, because a profile holds memory and stacks. Set -pprof-seconds to about the measured phase.

Both flags are refused with exit 2 when there is no -url, because a server the tool starts is read in process. -pprof-url also needs -pprof-dir.

For the generator’s own profile use -cpuprofile, -mutexprofile and -memprofile with a file path each. With a server in the process they cover the generator and the server together. Read the server’s share with go tool pprof -focus=protocol/server FILE.

Compare two builds

-bench FILE appends one line in Go benchmark format per run. Run each side at least six times, one right after the other, with identical flags, then compare the files with benchstat. A difference counts only with a p-value below 0.05, and ~ means no difference you can tell from noise. The full procedure is in docs/architecture/benchmarks.md in the repository.

for i in 1 2 3 4 5 6; do go run ./protocol/cmd/robotelos-load -followers 100 -events 300 -warmup 30 -interval 5ms -bench bench/before.txt > /dev/null; done

Suites

A suite runs a fixed list of cases, each -runs times (default 6), and writes the results to -out. The matrix is fixed, so a suite refuses the flags that would change it: -scenario, -followers, -conversations, -hold, -before, -during, -events, -warmup, -interval, -bench, -slo-p99 and the profile flags. It needs -out.

SuiteCases
smoke (4)fanout-followers-2, many-conversations-2, idle-connections-3, reconnect-followers-2. Small and quick.
baseline (10)fanout-followers-1, -10, -100, -1000. many-conversations-10, -100. idle-connections-100, -1000 (held 30 s each run). reconnect-followers-100, -1000.
go run ./protocol/cmd/robotelos-load -suite smoke -runs 3 -out stress-runs/smoke

A suite writes report.md (one row per case), all.txt, environment.txt and runs/<case>.<n>.json into -out, and one run record per case in its own <run_id>/ directory. A case needs at least 3 usable runs before it gets a number. Its exit code is that of its worst case. See Read the results.

Next steps