Cluster Overview

Cluster mode lets one LoadStrike run spread across multiple nodes. Use it when a single machine is not enough or when topology matters.

What this page helps you do

What this page helps you do

Understand when to move from one machine to coordinator-and-agent execution and what each node is responsible for.

Who this is for

Teams scaling beyond a single host or modeling separated source and destination roles.

Prerequisites

  • A working single-node scenario
  • A topology that benefits from multiple nodes or roles

By the end

A clear cluster mental model and the fields that must align across coordinator and agents.

Choose this path when

Move to cluster mode when one machine is not enough, when browser sessions need to be spread out, or when topology itself changes the result you care about.

Visual guide

Topology diagram showing one coordinator, multiple agents, NATS, and a merged final report.
The coordinator assigns work, agents execute it, and LoadStrike merges the node results into one report.

Guide

What cluster mode does

Cluster mode lets one coordinator orchestrate the run while one or more agents execute the assigned scenarios. The coordinator merges every node result into one final report. In the current Go release, the supported cluster path is a coordinator managing local child agents; direct Agent and distributed Go runs are unavailable.

When to use it

Use cluster mode when one machine is not enough for the desired load, when browser workloads need to be spread out, or when you want to model separate source and destination roles across nodes.

What makes nodes join the same run

ClusterId must match across the coordinator and agents. AgentGroup is optional but useful when one coordinator should target a specific pool of agents.

What the coordinator still needs

The coordinator still needs the registered scenarios, the expected AgentsCount, the node role, a valid runner key, and a transport for coordinator-agent communication such as NATS or the local-dev cluster mode.

Cluster setup samples

Distributed-capable SDK tabs show separate coordinator and agent processes. The Go tab instead shows the currently supported local coordinator path with coordinator-managed child agents; direct Agent and distributed Go runs are unavailable.

If you run these examples locally, add a valid runner key before execution starts. Set it with WithRunnerKey("...") or the config key LoadStrike:RunnerKey.

Coordinator Setup

using LoadStrike;

var clusterId = "orders-cluster";
var agentGroup = "perf-agents";
var natsUrl = "nats://nats.example.internal:4222";

var submitOrdersScenario = LoadStrikeScenario.Create(
        "submit-orders",
        _ => Task.FromResult(LoadStrikeResponse.Ok(statusCode: "200")))
    .WithLoadSimulations(LoadStrikeSimulation.IterationsForConstant(1, 2));

var waitForCompletionScenario = LoadStrikeScenario.Create(
        "wait-for-completion",
        _ => Task.FromResult(LoadStrikeResponse.Ok(statusCode: "200")))
    .WithLoadSimulations(LoadStrikeSimulation.IterationsForConstant(1, 2));

var agentContext = LoadStrikeRunner
    .RegisterScenarios(submitOrdersScenario, waitForCompletionScenario)
    .WithNodeType(LoadStrikeNodeType.Agent)
    .WithClusterId(clusterId)
    .WithAgentGroup(agentGroup)
    .WithAgentTargetScenarios("wait-for-completion")
    .WithNatsServerUrl(natsUrl);

// Start this on each agent machine or process first.
agentContext.Run();

var coordinatorContext = LoadStrikeRunner
    .RegisterScenarios(submitOrdersScenario, waitForCompletionScenario)
    .WithNodeType(LoadStrikeNodeType.Coordinator)
    .WithClusterId(clusterId)
    .WithAgentGroup(agentGroup)
    .WithAgentsCount(2)
    .WithCoordinatorTargetScenarios("submit-orders")
    .WithAgentTargetScenarios("wait-for-completion")
    .WithNatsServerUrl(natsUrl)
    .WithRunnerKey("rkr_your_remote_runner_key");

// Start this once after the agents are listening.
coordinatorContext.Run();

Cluster role fields

WithNodeType(nodeType)

Selects SingleNode, Coordinator, or Agent behavior where supported. Current Go cluster runs use Coordinator with local child agents; a direct Go Agent Run is unsupported.

WithClusterId(clusterId)

Required shared cluster identity across coordinator and agents.

WithAgentGroup(agentGroup)

Optional grouping field that lets a coordinator target a specific agent pool.

WithAgentsCount(agentsCount)

Coordinator-only expected agent count. The value must be greater than zero.

WithNatsServerUrl(natsUrl)

Points to the reachable NATS server used for cluster coordination. Go local coordinator mode also requires this value; it does not make a direct Go Agent Run available.

EnableLocalDevCluster(enable)

Starts coordinator-managed in-process child agents. This is the supported clustered path in the current Go release and is required for clustered Go V2, but single-node Go V2 does not need it. It does not embed or start NATS; start NATS separately and configure its URL.