Dynamic Workloads

Model changing traffic patterns using staged simulations and distribution controls.

Adaptive Traffic Shape

Use InjectRandom and Ramping* simulations to model variable traffic and progressive scaling instead of flat load only.

Scenario Weighting

Use WithWeight per scenario to bias assignment and throughput share when distributing scenarios across agents.

Runtime Control

Use context.StopScenario or context.StopCurrentTest from scenario code to stop execution based on dynamic runtime signals.

Feature Usage Samples

How to use snippets for Dynamic Workloads.

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.

Dynamic Workload

var scenario = LoadStrikeScenario.Create("dynamic", context =>
{
    if (context.InvocationNumber >= 500)
    {
        context.StopScenario("dynamic", "enough-load");
    }

    return Task.FromResult(LoadStrikeResponse.Ok());
})
.WithLoadSimulations(
    LoadStrikeSimulation.InjectRandom(5, 15, TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(20)),
    LoadStrikeSimulation.RampingConstant(8, TimeSpan.FromSeconds(20))
);

Pattern

Stage simulations

Chain multiple simulations in order to represent ramp-up, spikes, steady traffic, and cooldown in one scenario.

Use random injectors

Choose InjectRandom when the rate should vary from interval to interval instead of staying flat.

Stop from code

Use scenario context stop helpers when runtime conditions should end one scenario or the whole run dynamically.