简体   繁体   English

jmeter终极线程组中如何控制频率

[英]How to control frequency in jmeter ultimate thread group

I'm using Ultimate Thread Group in JMeter for a simple Script which includes some requests to emulate the login flow.我在 JMeter 中使用 Ultimate Thread Group 作为一个简单的脚本,其中包括一些模拟登录流程的请求。

Tests will be run in Non-GUI modes.测试将在非 GUI 模式下运行。 The script looks like that:脚本如下所示:

  1. Think time - dynamic value [3-5] seconds思考时间 - 动态值 [3-5] 秒
  2. Login登录
  3. Think time - dynamic value [3-5] seconds思考时间 - 动态值 [3-5] 秒
  4. Get token获取令牌
  5. Think time - dynamic value [3-5] minutes (to emulate the user session)思考时间 - 动态值 [3-5] 分钟(模拟用户会话)
  6. Log out登出

The total number of threads in the Ultimate Thread Group will be 250. Initial delay=0 Startup Time=250 Hold Load= 400 seconds Shutdown time= 250 Ultimate Thread Group 中的线程总数将为 250。初始延迟=0 启动时间=250 保持负载=400 秒关闭时间=250

I have questions have to do with Ultimate Thread Group and client frequency我有关于 Ultimate Thread Group 和客户端频率的问题

Ultimate Thread Group终极线程组

  1. Can I suppose that Jmeter will add 1 user per second till we got 250 users?我可以假设 Jmeter 每秒会增加 1 个用户,直到我们有 250 个用户?
  2. Then taking into account the dynamic think times, can I expect server throughput the maximum as server can reply?然后考虑到动态思考时间,我可以期望服务器吞吐量达到服务器可以回复的最大值吗?
  3. We will have ~ 250 concurrent requests per second from the client-side like the throughput from the client-side??我们每秒将有大约 250 个来自客户端的并发请求,就像来自客户端的吞吐量一样? I'm afraid that I can spam server too much..恐怕我可以向服务器发送太多垃圾邮件..

The client throughput客户端吞吐量

Can I use Constant Throughput Timer (CTT) for example if I will need to control throughput from the client-side?例如,如果我需要从客户端控制吞吐量,我可以使用恒定吞吐量计时器 (CTT) 吗? For example, I have the requirement - login flow 250 concurrent users, server throughput should be able to process ~ 5 requests per second.例如,我有一个要求 - 登录流 250 个并发用户,服务器吞吐量应该能够处理 ~ 每秒 5 个请求。

So in case of CTT using, should I remove all think times (except one - 2-3 minutes to emulate the user session) from the script and put only one CTT at the end of the script?因此,在使用 CTT 的情况下,我是否应该从脚本中删除所有思考时间(除了 1 - 2-3 分钟来模拟用户会话)并只在脚本末尾放置一个 CTT?

And my final settings will be:我的最终设置将是:

The total number of threads in the Ultimate Thread Group will be 250. Initial delay=0 Startup Time=250 Hold Load= 400 seconds Shutdown time= 250 Ultimate Thread Group 中的线程总数将为 250。初始延迟=0 启动时间=250 保持负载=400 秒关闭时间=250

How to configure CTT to make a load from the client-side 2 requests per second and considering 250 concurrent users?如何配置 CTT 以每秒从客户端加载 2 个请求并考虑 250 个并发用户?

With your setup使用您的设置

  1. Yes, the Ultimate thread group will add 1 user per second till you get 250 users.是的,Ultimate 线程组每秒会增加 1 个用户,直到获得 250 个用户。
  2. No, since you are using a think time (Hope it's the Uniform Random Timer) you will not get the maximum possible hits from JMeter to your server不,由于您使用的是思考时间(希望它是统一随机计时器),因此您不会从 JMeter 到您的服务器获得最大可能的命中
  3. No, as mentioned earlier, since you have the think time between 3 - 5 seconds, you will not experience an RPS of 250. but if you remove the think time without adding a timer to control throughput, it's possible to get a higher throughput ( sometimes even more than 250 )不,如前所述,由于您的思考时间在 3 到 5 秒之间,因此您不会体验到 250 的 RPS。但是如果您删除思考时间而不添加计时器来控制吞吐量,则可以获得更高的吞吐量(有时甚至超过 250 )

As you have planned, you can use the Constant Throughput Timer (in that case you can remove the think time).正如您所计划的,您可以使用恒定吞吐量计时器(在这种情况下,您可以删除思考时间)。 But for this case, if you have a request to have 2 requests per second, I recommend you to use the jp@gc - Throughput Shaping Timer .但是对于这种情况,如果您有每秒 2 个请求的请求,我建议您使用jp@gc - 吞吐量整形计时器 Because for some reason, it seems to work better with the ultimate thread group.因为出于某种原因,它似乎与最终线程组一起工作得更好。

Just to give you some inputs, I created a similar scenario in JMeter, please check the images bellow只是给你一些输入,我在 JMeter 中创建了一个类似的场景,请查看下面的图片

In this sample在这个样本中

Start Threads: 25, Initial delay: 0, Startup Time: 25,Hold Load: 10, Shutdown time: 25启动线程:25,初始延迟:0,启动时间:25,保持负载:10,关闭时间:25

在此处输入图像描述

In execution, if you check the jp@gc - Active Threads Over Time graph, it will look like this在执行过程中,如果您检查jp@gc - Active Threads Over Time图表,它将如下所示

在此处输入图像描述

This is your RPS ( Throughput ) when you add a think time当您添加思考时间时,这是您的 RPS(吞吐量)

在此处输入图像描述

If you remove the think time and if you did not have a timer to control throughput this is your RPS ( As you can see, even I have 25 threads, the RPS can go passing 25 )如果您删除思考时间并且如果您没有计时器来控制吞吐量,这就是您的 RPS(如您所见,即使我有 25 个线程,RPS 也可以 go 传递 25 )

在此处输入图像描述

But when you remove the think time and add a Timer ( I have added the timer to have a start and end RPS as 2 for 60s ) to control throughput will look like this.但是,当您删除思考时间并添加一个计时器(我已添加计时器以使开始和结束 RPS 为 2 为 60 秒)来控制吞吐量时,将如下所示。 As you can see, at any given time, the throughput will not exceed 2.如您所见,在任何给定时间,吞吐量都不会超过 2。 在此处输入图像描述

And If you add both the timer (RPS 2 for the 60s) and think the time the RPS will look like this.如果您添加两个计时器(60 年代的 RPS 2)并认为 RPS 的时间看起来像这样。 In this graph, you will see there are some scenarios where the RPS is more than 2. That happens due to the think time.在此图中,您将看到 RPS 大于 2 的某些情况。这是由于思考时间造成的。 ( If the previous request have a Think time of 5s and new two have a 3s ) This can happen. (如果前一个请求的思考时间为 5 秒,而新的两个请求的思考时间为 3 秒)这可能会发生。 but it will not harm the test.但它不会损害测试。 在此处输入图像描述

so in your plan, you add所以在你的计划中,你添加

  • The total number of threads in the Ultimate Thread Group will be 250. Initial delay=0 Startup Time=250 Hold Load= 400 seconds Shutdown time= 250 Ultimate Thread Group 中的线程总数将为 250。初始延迟=0 启动时间=250 保持负载=400 秒关闭时间=250
  • Throughput shaping timer or CTT to control the expected throughput吞吐量整形定时器或 CTT 来控制预期的吞吐量
  • Keep the think time to create a more realistic behaviour ( optional )留出思考时间来创造更现实的行为(可选)

Note: you can always use dummy samplers and try out to check if you meed the expected outcome of your plan.注意:您始终可以使用虚拟采样器并尝试检查您是否达到了计划的预期结果。

Hope this helps.希望这可以帮助。 Cheers干杯

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM