gpt4 book ai didi

testing - 在 Jmeter 中,我必须将线程数分成不同百分比的多个 http 请求,但必须保持顺序不变

转载 作者:行者123 更新时间:2023-11-28 20:28:51 24 4
gpt4 key购买 nike

我正在通过 jmeter 在电子商务网站上进行负载测试,我必须将线程数分成不同百分比的多个 http 请求,但必须保持顺序与树中的排列相同

例子:

Thread(1000)
++Login(20%)
++autoLogin(40.60%)
++addToCart(30.40%)
++Logout(9%)

为了实现百分比分配,我使用了吞吐量 Controller ,但执行顺序发生了变化,导致整个测试计划失败。请提出任何其他实现方式。

最佳答案

JMeter 提供了 3 个选项来配置加权负载和突出显示选项。

  1. 不同 Thread Groups有不同数量的线程
  2. Throughput Controller
  3. Switch ControllerWeighted Switch Controller插件。

这里我只引用这三种技术的介绍,完整的细节请查看 Blazemeter 博客 Running JMeter Samplers with Defined Percentage Probability .您可以尝试遵循该博客中所述的任何一个过程。

  • 使用具有不同线程数的不同线程组:

Probably the easiest way to implement a distributed scenario when N% of users execute task A, M% of users do task B, etc. is setting up different test groups with the relevant percentage of virtual users configured. For example, given the aforementioned scenario with 40%-30%-20%-10% distribution, we’ll need 4 Thread Groups having 40, 30, 20 and 10 threads correspondingly. You can divide or multiply these numbers by any reasonable factor as per your load test plan; you just have to make sure that the factor is the same.

  • 使用具有不同执行百分比的吞吐量 Controller :

Throughput Controller is a slightly misleading name as it does not control throughput (Constant Throughput Timer does - though to be fair “Constant Throughput Timer” does not necessarily need to be “constant” either, but that’s out of scope for this article). Instead of managing throughput, the controller defines how often its child elements are executed.

  • 使用开关 Controller :随机加权值:

Another option to determining the defined samplers' execution percentage rate is using Switch Controller. Switch Controller provides the option to run one of its subordinate samplers based on the “Switch Value” which could be:

  • An integer - the child element which is index based on the Switch Value will be executed. The numbering is zero-based. If there is no match or the Switch Value is blank/unset - the first child element will be executed.
  • A string - the child element whose name equals the Switch Value string will be executed.

希望这对您有所帮助。

关于testing - 在 Jmeter 中,我必须将线程数分成不同百分比的多个 http 请求,但必须保持顺序不变,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39430526/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com