Jmeter - 模拟更复杂的负载场景?

发布于 2024-10-22 03:06:05 字数 250 浏览 5 评论 0原文

一直在尝试使用 Jmeter,我想知道实现的最佳方法:

20 个用户登录应用程序,持续 20 分钟以上,并在另外 20 分钟内执行一些操作,然后在 20 分钟内注销。即有 200 个用户登录,然后一旦所有用户都登录,就开始 20 分钟计时器。 20 分钟结束后,开始记录最早登录的用户。

我意识到这可能是也可能不是一个现实的测试场景,但我想看看是否可能。

目前我有一个测试计划,用户登录,执行一些操作,然后注销。我不知道如何加速和减速。

Been experimenting with Jmeter, and I'd like to know the best way to accomplish:

20 users logging onto an application, over 20 minutes, and performing some actions for another 20 minutes, before logging off over a period of 20 minutes. I.e. have 200 users logging on, and then once ALL of them are logged on, begin 20 minute timer. Once 20 minutes are up, start to log the ones who logged on earliest off.

I realise this MAY or MAY NOT BE a realistic testing scenario, but i'd like to see if it's possible.

At the moment I have a test plan whereby a user logs on, performs some actions, and then logs off. I can't see how I can ramp up and ramp down.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

对你的占有欲 2024-10-29 03:06:05

测试计划中有一个选项“连续运行线程组”。将其设置为选中。

然后将 3 个线程组添加到您的测试计划中。我建议第一个使用线程组(20 个线程,循环计数 1,加速时间 1),第二个使用终极线程组(20 个线程立即启动并保持负载 20 分钟),第三个再次使用线程组(20 个线程,循环)计数 1,加速时间 1)。

在每个 TG 内放置适当的采样器 - 第一个仅登录,第二个执行操作,第三个注销。

就是这样。如果您有任何问题 - 请告诉我。

There's an option in Test Plan "Run thread groups consecutively". Set it to checked.

Then add 3 thread groups to your test plan. I'd suggest using Thread Group for first (20 threads, loop count 1, ramp up time 1), Ultimate Thread Group (20 threads starting immediately and holding load for 20min) for second and Thread Group again for third (20 threads, loop count 1, ramp up time 1).

Place appropriate samplers inside each TG - first just logs in, second does actions, third logs off.

That's it. If you have any troubles - let me know.

孤蝉 2024-10-29 03:06:05

您需要在 JMeter 中启动多个线程组并以不同的时间间隔运行,这样您就可以确保先启动的用户先结束。

另请参阅相关问题

You'll need several thread groups in JMeter starting off and running at different intervals, in that way you could ensure that the users who start first will end first.

Also see a related question on this.

只为一人 2024-10-29 03:06:05

您可以让用户数量 = 20、启动时间 = 1200 秒(每分钟 1 个)、测试开始和测试结束时间之间的时间差 = 20 分钟来实现此目的。

You can have no of users=20, ramp up time=1200 sec (1 per min), difference of time between test start and test end time=20 min to achieve that.

沫离伤花 2024-10-29 03:06:05

我想我过去也遇到过类似的问题,

我想这样做:

首先将线程组设置为有 20 个线程,加速周期为 60 秒

登录后放置“测试操作”(在采样器菜单中)
目标=当前线程,如果你想安全的话,有动作暂停和20分钟(1 200 000毫秒)或更长时间。

在此测试操作之后,输入您的所有导航请求。

导航完成后,放置另一个具有与前一个相同设置的“测试操作”

(目标 = 当前线程,操作暂停和 20 分钟(1 200 000 毫秒))
将 logouf 请求放在采样器之后。

这应该涵盖你的情况。

请注意,采样器只是暂停您的线程,因此启动的第一个线程应该是第一个结束的线程。

如果您想将其扩展到 200,您只需将线程组启动周期更改为 6 或 5 秒。

希望有帮助。

I think I had a similar problem in the past

Here Want I've did:

First set your thread group to have 20 thread with a rampup period of 60 seconds

After the login put a "test action" (in the sampler menu)
target = current thread, with the action pause and 20 minutes (1 200 000 ms) or more if you want to be safe.

After this test action, put all your navigating request.

Once your navigation is done, put another "test action" with the same setting has the previous one

(target = current thread, with the action pause and 20 minutes (1 200 000 ms))
put the logouf request after the sampler.

This should cover you case.

Take note that the sampler just pause your thread so the first thread that start should be the first thread that end.

If you want to scale it to 200 you just need to change your thread group rampup period to 6 or 5 seconds.

hope it's help.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文