Agents And Coordinator

Learn how coordinator and agent nodes split, execute, and merge one clustered LoadStrike run.

What this page helps you do

What this page helps you do

Learn how coordinator and agent nodes split, execute, and merge one clustered LoadStrike run.

Who this is for

Teams moving from one machine to coordinator-and-agent execution or tighter workload targeting.

Prerequisites

  • A scenario that already works in a single-node run

By the end

A clearer cluster topology and the fields that must line up across nodes.

Use this page when

Use this page when execution topology, partitioning, or targeting changes how the run should be distributed.

Visual guide

Cluster topology diagram showing the coordinator, agents, and merged result.
Cluster settings matter because the coordinator, agents, and merged result all belong to the same workload definition.

Guide

Two ways to run cluster mode

SDKs that support distributed mode use NodeType plus NatsServerUrl so separate coordinator and agent processes can communicate over NATS. EnableLocalDevCluster(true) starts coordinator-managed local child agents. The current Go release supports only that local coordinator path, still requires a reachable NatsServerUrl, and does not embed or start NATS; direct Agent and distributed Go runs are unavailable.

What the coordinator controls

The coordinator sets ClusterId, AgentGroup, AgentsCount, supported target lists, and ClusterCommandTimeout. It is also the node that produces the final merged report. Go V1 applies AgentTargetScenarios but not CoordinatorTargetScenarios. Clustered Go V2 requires local cluster mode and rejects both role-specific target lists; single-node Go V2 does not require cluster settings.

What agents need

In SDKs with distributed agents, agents need NodeType.Agent, the same ClusterId, the same AgentGroup if one is used, and the NATS server URL. Go does not currently support a direct Agent Run; its local children are created and identified by the coordinator.

How scenario targeting works

TargetScenarios applies a shared filter. AgentTargetScenarios and CoordinatorTargetScenarios split work by role only where the selected SDK and engine support them. In Go V1, AgentTargetScenarios applies but CoordinatorTargetScenarios is accepted without being applied; Go V2 rejects both role-specific lists.

Cluster setup samples

Distributed-capable SDK tabs can register scenarios in separate role processes. The Go tab uses one local coordinator: V1 can apply AgentTargetScenarios, CoordinatorTargetScenarios is not applied, and V2 rejects both role-specific lists.

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 + Agent Configuration

using LoadStrike;

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

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

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

var agentContext = LoadStrikeRunner
    .RegisterScenarios(publishOrdersScenario, observeCompletionScenario)
    .WithNodeType(LoadStrikeNodeType.Agent)
    .WithClusterId(clusterId)
    .WithAgentTargetScenarios("observe-completion")
    .WithNatsServerUrl(natsUrl);

// Each agent process listens for the scenario names assigned to agents.
agentContext.Run();

var coordinatorContext = LoadStrikeRunner
    .RegisterScenarios(publishOrdersScenario, observeCompletionScenario)
    .WithNodeType(LoadStrikeNodeType.Coordinator)
    .WithClusterId(clusterId)
    .WithAgentsCount(2)
    .WithCoordinatorTargetScenarios("publish-orders")
    .WithAgentTargetScenarios("observe-completion")
    .WithNatsServerUrl(natsUrl)
    .WithRunnerKey("rkr_your_remote_runner_key");

// The coordinator triggers only its own scenarios and routes agent work by scenario name.
coordinatorContext.Run();

Coordinator and agent settings

NodeType

Coordinator merges results and assigns work. Agent executes assigned scenarios where separate agent processes are supported. Current Go cluster runs use a local Coordinator because direct Agent execution is unavailable.

ClusterId / AgentGroup

Must line up between the participating processes so they join the same run and, optionally, the same agent pool.

AgentsCount

Coordinator expectation for how many agents should participate.

NatsServerUrl

Transport used for distributed coordinator-agent communication in SDKs that support separate agent processes.

TargetScenarios / AgentTargetScenarios / CoordinatorTargetScenarios

TargetScenarios is the shared filter. Go V1 applies AgentTargetScenarios but not CoordinatorTargetScenarios; Go V2 rejects both role-specific lists. Other SDK tabs describe their supported role split.

ClusterCommandTimeout

Coordinator wait budget for cluster coordination commands and result collection.

EnableLocalDevCluster

Development-only convenience mode that removes the need for separately managed agent processes.

{
  "LoadStrike": {
    "NodeType": "Coordinator",
    "ClusterId": "orders-cluster",
    "AgentGroup": "perf-agents",
    "AgentsCount": 3,
    "RunnerKey": "rkr_your_remote_runner_key",
    "NatsServerUrl": "nats://localhost:4222",
    "TargetScenarios": "http-source,kafka-consumer",
    "AgentTargetScenarios": "kafka-consumer",
    "CoordinatorTargetScenarios": "http-source",
    "ClusterCommandTimeoutMs": 120000,
    "EnableLocalDevCluster": false
  }
}