-
Notifications
You must be signed in to change notification settings - Fork 138
Expand file tree
/
Copy pathScenarioWeightExample.cs
More file actions
37 lines (33 loc) · 1.09 KB
/
ScenarioWeightExample.cs
File metadata and controls
37 lines (33 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using NBomber.CSharp;
namespace Demo.Features.DynamicWorkload;
public class ScenarioWeightExample
{
public void Run()
{
var readScenario = Scenario.Create("read_scenario", async context =>
{
await Task.Delay(100);
return Response.Ok();
})
.WithoutWarmUp()
.WithLoadSimulations(
// we use the same LoadSimulation settings
Simulation.Inject(rate: 10, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30))
)
.WithWeight(80); // sets 80%
var writeScenario = Scenario.Create("write_scenario", async context =>
{
await Task.Delay(100);
return Response.Ok();
})
.WithoutWarmUp()
.WithLoadSimulations(
// we use the same LoadSimulation settings
Simulation.Inject(rate: 10, interval: TimeSpan.FromSeconds(1), during: TimeSpan.FromSeconds(30))
)
.WithWeight(20); // sets 20%
NBomberRunner
.RegisterScenarios(readScenario, writeScenario)
.Run();
}
}