【问题标题】:Load test and RPS in NBomberNBomber 中的负载测试和 RPS
【发布时间】:2022-11-20 22:55:21
【问题描述】:

我正在尝试在我们的一台服务器上对 Kafka 实例进行负载测试。 这是使用 NBomber 执行此操作的代码:

public static void Run()
{
    var testScenario = NBomber.CSharp.Step.Create("testScenario",
        
        async context =>
    {
        try
        {
            // The testData is a string variable that reads contents from a text file in the Init method.
            var kafkaObject = new KafkaObject { Topic = TestTopic, Message =testData };
            SampleKafkaFlow sampleKafkaFlow = new SampleKafkaFlow();
            var response = await sampleKafkaFlow.SendMessageToKafka(kafkaObject);
            return Response.Ok();
        }
        catch (Exception ex)
        {
            return Response.Fail(ex.Message);
        }
    });

    var scenario = ScenarioBuilder.CreateScenario("scenario", testScenario)
        .WithoutWarmUp()
        .WithInit(Init)
    .WithLoadSimulations(new[]
        {
            Simulation.InjectPerSec(rate: 100, during: TimeSpan.FromMinutes(3))
        });

    NBomber.CSharp.NBomberRunner
        .RegisterScenarios(scenario)
        .WithReportFileName($"testScenario-Report-{DateTime.UtcNow.ToString("yyyy-dd-M--HH-mm-ss")}")
        .WithReportFolder("test_reports")
        .WithReportFormats(ReportFormat.Html)
        .Run();
}

我的笔记本电脑配置:

第 10 代酷睿 i5 配备 16 Gb RAM,运行 Windows 10。

在运行负载测试时,只有 VS 2022 在运行。

现在我假设在 100 RPS 下它会在 3 分钟的执行时间内生成总共 18k 个请求。报告显示不同 - 虽然它确实运行了总共 3 分钟,但总共只有 2057 个请求!

我在这里错过了什么?

如何使用更高的 RPS 进行负载测试?

提前致谢。

【问题讨论】:

    标签: .net-core load-testing


    【解决方案1】:

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-02-10
      • 1970-01-01
      相关资源
      最近更新 更多