Skip to content
LoadStrike
Portal

Search LoadStrike

GOOD PLACES TO START

ClusterCode 59 / 69

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

All updated SDKs use NodeType plus NatsServerUrl for separate coordinator and Agent processes over NATS. EnableLocalDevCluster(true) starts coordinator-managed local children instead. Go requires a separately started NATS server in both modes; remote Go V2 requires the corresponding updated SDK and runtime.

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 supports local or separate NATS agents, and rejects both role-specific target lists; single-node Go V2 does not require cluster settings.

What agents need

Agents need NodeType.Agent and the same ClusterId, SessionId, AgentGroup and NATS server URL. Remote V2 also requires a stable AgentId included in the coordinator ExpectedAgentIds roster, the same V2 workload definitions and compatible SDK settings. Start agents before the coordinator. Go keyless agents need a preinstalled verified compatible runtime.

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

All updated SDKs can register matching workloads in separate role processes. Go V1 applies AgentTargetScenarios; CoordinatorTargetScenarios is not applied. Go V2 rejects both role-specific lists and requires the matching non-correlated no-warm-up workload on every agent.

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

ParameterDescription
NodeType

Coordinator assigns work and merges results. Agent executes authorized assignments in a separate process over NATS, or as a coordinator-managed local child.

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
  }
}