Data Partition
Usually, working in the cluster mode requires handling data by partitions (key ranges). NBomber provides built-in functionality for this called Scenario Auto Partitioning. During the scenario initialization phase, each agent can receive a partition number (e.g., 1, 2, 3, …). Based on this number, you can determine the data range assigned to that agent. For example, if PartitionNumber = 1, it means that this particular agent will handle user IDs ranging from 0 to 100.

Scenario Auto Partitioning
When you run a Scenario in the cluster, NBomber will:
- Get all agents that run particular scenarios.
- Automatically assign a scenario partition number to each Agent.
You can read ScenarioPartition on the Scenario Init phase, and then, based on the number you get, you can derive what key ranges should be loaded.
Scenario
.Create("my-scenario", async context => { ... }
.WithInit(context =>
{
// based on the number you get, you can derive what key ranges should be loaded.
var partitionNumber = context.ScenarioPartition.Number;
// Count: returns overall scenario partition count across the cluster.
var partitionCount = context.ScenarioPartition.Count;
})