我应该如何计算 Jmeter 中的 Ramp-up 时间

How should I calculate Ramp-up time in Jmeter

这里有很多 questions/answers 可供理解 Ramp up time 但我想为我的测试用例获取一些详细信息。

测试用例 : 预计主页上每 5 分钟有 1200 个用户。所以它会像 5 users/second.

我设置了以下 thread properties :

No. of Threads : 1200

Ramp-up Time - ? [I am not sure what to set]

Loop count - Forever

Scheduler - 300 Seconds[5 Minutes]

任何人都可以帮我为我的测试用例设置 ramp up time 吗?我是 运行 在本地机器上进行测试。

我想检查服务器在 5 分钟内可以处理多少用户。我们的期望是 1200 users.

Rampup 是用户到达您的应用程序的速度。 您输入的数字意味着一旦达到所有线程都已启动。 越小,用户到达的速度就越快。 所以没有人可以为你解答,你需要分析你的流量。

关于线程数,1200 个线程可能不是一个好的数字,因为 1200 个用户可能会缓慢或快速地浏览应用程序。 您需要的是添加一个恒定吞吐量计时器来控制您将达到的每秒事务量。

您应该使用标准集中可用的 Ultimate Thread Group 插件。 为了保持并发性,配置应该是这样的:

Start Thread Count: 1200
Initial delay, sec: 0
Startup, sec: 60
Hold Load: 180
Shutdown Time, sec: 60

终极线程组

此处将生成所有 1200 threads,并在 Startup time(加速时间)的 60 sec 内生成。这 1200 个线程将在下一个 180 sec 中处于活动状态,之后,这些线程将在下一个 60 sec.

内关闭

所以测试的总持续时间是 300 秒,如您所愿。在整个 Hold Load 时间(180 秒)内,请求将被循环。 这个终极线程组会让你更好地控制线程。

现在,如果您想控制 transactions per second 的速率或要执行的样本数,您可以使用 Constant Throughput Timer。 Constant Throughput Timer 可让您控制要发送的请求的流量。默认 "Thread Group" 仅控制用户或线程的方式 generated.It 不控制请求的速率 application.So 为此目的,您可以使用 "Constant Throughput Timer" 来控制你每秒的请求。有关更多详细信息,您可以通过 JMeter documentation.

根据您的 test caseduration 设置,我认为您混淆了 Threads 和请求.

简而言之:对于这种情况,您必须使用 Ramp-up 作为 240 seconds

让我详细描述一下:

Ramp up 是所有 用户 到达您测试的应用程序服务器的时间。

请求采样器模拟,但线程是[=59=的模拟]用户.

请注意- 请求总数throughput,而执行相同操作的活动线程数 activity 与 concurrency.

有关

根据您的要求,我假设您要测量与 requests/second 而不是 每秒用户数。为此,您可以在 测试计划级别 使用 Constant Throughput Timer

恒定吞吐量计时器 允许您保持服务器的吞吐量 (requests/sec)。这里 请求 采样器 线程 users/clients 正在使用采样器请求服务器。

您可以同时使用 "Thread Group""Ultimate Thread Group".

据我所知,无论您使用哪种类型的线程组和 Constant Throughput timer,在测试结束时的结果中,您将获得您在 Constant Throughput Timer 中提到的所需吞吐量,即如果您在 Constant Throughput Timer 中提到 1200/min with "Calculate Throughput based on"值为 "All active threads" 并且线程组中有 3 个请求(采样器),然后 JMeter 将以仅生成 6.6 requests/sec 对于每个采样器,即 1200/min 分为 3 个请求,无论您使用的是 Ultimate Thread Group 还是 线程组;吞吐量计时器对所有类型的线程组以相同的方式工作。

现在根据您的要求:(使用线程组):

No. of Threads : 1200

Ramp-up Time - 240 (Since you want 5 users per second, 1200/5= 240)

Loop count - Forever

Scheduler (Duration) - 780 Seconds [13 Minutes]

重要提示:

Thread Group configurations will be the same which you have already mentioned. Number of threads will be the client load which you want to put(in you case it's 1200), duration : (240+300+240), loop : forever, ramp-up : 240 yes when you ramp up i.e. in the first minute generally you get more requests as threads are starting so it is normal behavior. To test your scenario run for exactly 5 minutes, you should test for 13 minutes. Exclude first 4 min and last 4 min of the test as that is warm up time for your test as well as server and last 4 min are warm down period.

现在根据您的要求:(使用终极线程组):

Start Thread Count: 1200
Initial delay, sec: 0
Startup, sec: 240 (I assume you want 5 users come to your application for requesting expected samples per second)
Hold Load for: 300 sec (Since you required 5 minutes to test for 1200 users)
Shutdown Time, sec: 240

你可以这样设置:

不要混淆 线程数 请求数 ,每个线程将在字段 保持负载