Agents And Controller
Configure coordinator and agent nodes for local and distributed cluster execution with deterministic scenario targeting.
Why Use Cluster Mode
Cluster mode distributes workload across agent nodes and merges all node statistics into one final report. Use it when single-node capacity is not enough or when you want topology-aligned load generation.
Controller Role (Coordinator)
Coordinator plans scenario assignments, optionally executes coordinator-target scenarios, waits for agent results, aggregates node stats, and produces final reports.
Agent Role
Agent waits for coordinator run command, executes assigned scenarios only, and returns node stats to coordinator. In distributed mode, agent runs with reports and console metrics disabled by design.
Execution Paths
Local dev cluster path runs coordinator plus in-process child agents when NodeType is Coordinator and EnableLocalDevCluster is true. Distributed path uses NATS when NatsServerUrl is set. Python now routes both paths directly through LoadStrikeRunner.Run() / RunDetailed() rather than requiring a separate orchestration entry point.
Assignment And Targeting Rules
If AgentTargetScenarios is set then every agent runs the same explicit targets. Otherwise scenarios are distributed by scenario weight in round-robin. CoordinatorTargetScenarios controls scenarios that coordinator executes itself, and those coordinator-only targets are excluded from agent assignments.
Configuration Inputs
You can configure cluster settings via fluent API, JSON config keys under LoadStrike, or CLI args such as --NodeType, --ClusterId, --AgentGroup, --AgentsCount, --NatsServerUrl, --AgentTargetScenarios, and --CoordinatorTargetScenarios. NodeType parsing is strict and supports Single/SingleNode/Coordinator/Agent (or 0/1/2).
Timeout And Failure Behavior
ClusterCommandTimeout controls how long coordinator waits for distributed agent results. Missing agent responses are reported as cluster warnings and reflected in final run diagnostics.
Feature Usage Samples
How to use snippets for Agents And Controller.
Switch between C#, Java, Python, TypeScript, and JavaScript to see the native SDK shape for this sample.
Licensing note: every runnable sample requires a valid runner key via WithRunnerKey("...") or config key LoadStrike:RunnerKey.
Coordinator + Agent Configuration
LoadStrikeRunner
.RegisterScenarios(httpScenario, kafkaScenario)
.WithNodeType(LoadStrikeNodeType.Coordinator)
.WithClusterId("orders-cluster")
.WithAgentsCount(2)
.WithCoordinatorTargetScenarios("http-source")
.WithAgentTargetScenarios("kafka-consumer")
.WithRunnerKey("rkr_your_remote_runner_key")
.Run();
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeNodeType;
import com.loadstrike.runtime.LoadStrikeRuntime.LoadStrikeRunner;
LoadStrikeRunner
.registerScenarios(httpScenario, kafkaScenario)
.withNodeType(LoadStrikeNodeType.Coordinator)
.withClusterId("orders-cluster")
.withAgentsCount(2)
.withCoordinatorTargetScenarios("http-source")
.withAgentTargetScenarios("kafka-consumer")
.withRunnerKey("rkr_your_remote_runner_key")
.run();
from loadstrike_sdk import LoadStrikeRunner
LoadStrikeRunner.register_scenarios(http_scenario, kafka_scenario) \
.with_node_type("Coordinator") \
.with_cluster_id("orders-cluster") \
.with_agents_count(2) \
.with_coordinator_target_scenarios("http-source") \
.with_agent_target_scenarios("kafka-consumer") \
.with_runner_key("rkr_your_remote_runner_key") \
.run()
import { LoadStrikeRunner } from "@loadstrike/loadstrike-sdk";
await LoadStrikeRunner
.registerScenarios(httpScenario, kafkaScenario)
.withNodeType("Coordinator")
.withClusterId("orders-cluster")
.withAgentsCount(2)
.withCoordinatorTargetScenarios("http-source")
.withAgentTargetScenarios("kafka-consumer")
.withRunnerKey("rkr_your_remote_runner_key")
.run();
const { LoadStrikeRunner } = require("@loadstrike/loadstrike-sdk");
await LoadStrikeRunner
.registerScenarios(httpScenario, kafkaScenario)
.withNodeType("Coordinator")
.withClusterId("orders-cluster")
.withAgentsCount(2)
.withCoordinatorTargetScenarios("http-source")
.withAgentTargetScenarios("kafka-consumer")
.withRunnerKey("rkr_your_remote_runner_key")
.run();
Cluster Config (appsettings.json)
Chooses whether the process acts as a coordinator or an agent.
Must match across coordinator and agents so they participate in the same distributed run.
Lets the coordinator target a specific pool of agents.
Tells the coordinator how many agents it expects to participate.
Specifies the NATS endpoint used for coordinator-agent communication.
Use TargetScenarios, AgentTargetScenarios, and CoordinatorTargetScenarios to split the workload across roles.
Runs a local coordinator with in-process child agents for development and smaller test setups.
{
"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
}
}