Gatling 场景:100 users/seconds 10 分钟,每 30 秒达到 500users/seconds 的峰值

Galting scenerio : 100 users/seconds for 10mins with a peak of 500users/seconds for every 30seconds

我想针对以下场景进行性能测试: 100 users/seconds 持续 10 分钟,峰值为每 30 秒 users/seconds 500

我正在使用节流来实现这个

scn.inject(constantUserPersecond(100) during (10 minutes))
.throttle(reachRps(500) in (30 seconds),
  holdFor(1 sec)
)

我没有得到预期的输出。 根据我的理解,我应该每 30 秒在图表中获得 20 个峰值。 我说得对吗?还有其他方法吗?

请帮忙,我是加特林新手

I am using throttling to achieve this

您没有正确阅读 documentation

You still have to inject users at the scenario level. Throttling tries to ensure a targeted throughput with the given scenarios and their injection profiles (number of users and duration). It’s a bottleneck, ie an upper limit. If you don’t provide enough users, you won’t reach the throttle. If your injection lasts less than the throttle, your simulation will simply stop when all the users are done. If your injection lasts longer than the throttle, the simulation will stop at the end of the throttle.

您必须配置正确的注入配置文件(并且可能不使用节流)。

您的测试产生的吞吐量取决于:

  • 注入曲线=>
  • 您的场景中的请求数
  • 请求之间的暂停

所有这些都是你可以根据你的用例弄清楚的事情。

通过关注解决了问题

SetUp(scn.inject(constantUserPersecond (100) during(600 seconds)), scn2.inject(nothingFor(10 seconds), splitUsers(500*20)) into atOnceUserd(500) separatedBy(30 seconds)))

要求是: 100 用户/秒,持续 10 分钟 峰值为 500 用户/30 秒