JMeter – 仅在CLI模式下的setUp线程组无限循环

huangapple go评论64阅读模式
英文:

JMeter - setUp Thread Group infinite loop only in CLI mode

问题

我正在尝试使用 JMeter 对 IBM MQ 消费者进行性能测试。

我在这里找到了一篇非常有用的文章:https://community.ibm.com/community/user/integration/blogs/paul-harris1/2022/11/28/testing-mq-with-jmeter 。

这篇文章提供了一个链接到 GitHub 存储库的示例 JMeter 测试计划:https://github.com/ibm-messaging/mqperf/tree/gh-pages/jmeter

我下载了测试计划,并删除了所有的 "receiver" 元素,因为我只需要测试计划来向 MQ 队列发送消息。

测试计划看起来像这样:

JMeter – 仅在CLI模式下的setUp线程组无限循环

"setup Thread Group (Sender Connections)" 元素为每个 JMeter 用户创建一个与队列管理器的连接。它的配置如下:

JMeter – 仅在CLI模式下的setUp线程组无限循环

因此,我期望它在测试计划执行期间仅运行一次。

当我从 GUI 运行测试计划时,测试计划执行的步骤如下:

JMeter – 仅在CLI模式下的setUp线程组无限循环

"Create Sender Connections to Queue Manager" 仅运行一次,符合预期。

但是,当我从 CLI 运行我的测试计划时,使用以下命令:

~/apps/apache-jmeter-5.6/bin$ ./jmeter.sh -n -t ~/my-mq-plan.jmx -e -o mq_reports -l mq_logs.log

我看到 jmeter 无限执行 "Create Sender Connections to Queue Manager" 步骤:

JMeter – 仅在CLI模式下的setUp线程组无限循环

队列管理器最终会回复错误,因为连接已经用尽。并且没有消息发送到队列。

我不明白为什么会出现这种奇怪的行为。

  • 我检查了 JMeter CLI 选项,查阅了 JMeter 文档,查找 GUI 执行和 CLI 执行之间的区别。我没有找到任何可以帮助我解决问题的信息。
  • 我尝试禁用监听器。
  • 我发现了这个 Stack Overflow 问题,它看起来有点像我的问题,但是答案对我没有帮助:https://stackoverflow.com/questions/48165101/jmeter-test-works-differently-from-cli-than-gui-why
  • 我甚至尝试在选择测试计划的每个元素后点击 "保存" 按钮,以防 JMeter 没有保存所有元素。

编辑:我已经尝试过的其他事情

  • 我关闭并重新打开 GUI,以确保文件已保存在磁盘上。
  • 我检查了 jmx 文件的 XML 内容。
  • 每次在 CLI 中运行测试计划时,我都删除生成的文件。
  • 我更改了 -t 参数,传递了文件的绝对路径。在 GUI 中,我看到完全相同的路径。
  • 我检查了 MQ 控制台。在 GUI 中运行时,只有一个连接。在 CLI 中运行时,我看到了超过 200 个连接到队列管理器。

是什么原因导致了这种奇怪的行为?

英文:

I'm trying to use JMeter to make some performance tests on an IBM MQ consumer.

I found a very useful article there: https://community.ibm.com/community/user/integration/blogs/paul-harris1/2022/11/28/testing-mq-with-jmeter .

The article gives a link to a github repository with the example JMeter test plan: https://github.com/ibm-messaging/mqperf/tree/gh-pages/jmeter

I downloaded the test plan and removed all the "receiver" elements as I need the test plan only to produce messages to the MQ queue.

The test plan looks like this:

JMeter – 仅在CLI模式下的setUp线程组无限循环

the "setup Thread Group (Sender Connections)" element creates one connection to the queue manager per JMeter user. It is configured like this:

JMeter – 仅在CLI模式下的setUp线程组无限循环

So I expected it to run only once per test plan execution.

When I run the test plan from GUI, these are the steps executed by the test plan:

JMeter – 仅在CLI模式下的setUp线程组无限循环

The "Create Sender Connections to Queue Manager" is run only once, as expected.

But, when I run my test plan from CLI, using this command:

~/apps/apache-jmeter-5.6/bin$ ./jmeter.sh -n -t ~/my-mq-plan.jmx -e -o mq_reports -l mq_logs.log

I see that jmeter executes indefinitely the "Create Sender Connections to Queue Manager" step:

JMeter – 仅在CLI模式下的setUp线程组无限循环.

The queue manager finally replies with errors as connections are exhausted. And no message was sent to the queue.

I don't understand why.

  • I checked JMeter CLI options, I checked in the JMeter doc what are the differences between GUI execution and CLI execution. I didn't find anything that could help me to fix the issue.

  • I tried to disable listeners.

  • I found this SO question which looks a little bit like my issue but really a little bit and the accepted answer does not help me anyway: https://stackoverflow.com/questions/48165101/jmeter-test-works-differently-from-cli-than-gui-why

  • I event tried to click on the "save" button after selecting each element of the test plan, just in case JMeter does not save all elements.

EDIT: other things I already tried

  • I closed and reopen the GUI to make sure the file is saved on disk.

  • I checked the xml content of the jmx file :

JMeter – 仅在CLI模式下的setUp线程组无限循环

  • Everytime I run the the test plan in CLI, I delete the generated files :
rm -Rf mq_reports/ && rm mq_logs.log
./jmeter.sh -n -t /home/derek/MQ-Sender-Only-Plan.jmx -e -o mq_reports -l mq_logs.log

  • I changed the -t argument to pass the absolute path of the file (see previous bullet point). I see exactly the same path in the GUI:

JMeter – 仅在CLI模式下的setUp线程组无限循环

  • I checked the MQ console. When running with GUI, there's only one connection. When running with CLI, I see more than 200 connections to the queue manager.

What could cause this strange behavior ?

答案1

得分: 1

这是JMeter 5.6版本中的一个bug:https://github.com/apache/jmeter/issues/6008

请等待5.6.1版本发布或继续使用5.5版本。

英文:

This a bug in the 5.6 release of JMeter : https://github.com/apache/jmeter/issues/6008

Wait for the 5.6.1 release or stick to 5.5.

答案2

得分: 0

如果在GUI模式和非GUI模式下看到不同的行为,这意味着您正在运行不同的测试计划。

检查jmeter.log文件,它包含.jmx脚本的完整路径,每个线程组启动的线程数,线程终止原因等等(特别是如果您增加JMeter日志的详细程度到DEBUG级别)。

所以我的期望是:

  1. 要么您忘记保存您的.jmx脚本。
  2. 要么您正在运行不同的脚本。
  3. 要么您的.jtl文件中有以前的结果,而新的结果基本上是追加到其中,请尝试在JMeter命令行中添加-f选项,这样它会删除.jtl文件,而不是向其中添加新的指标。
英文:

If you see different behaviour in GUI and non-GUI modes it means that you're running different test plans.

Check jmeter.log file, it has the full path to the .jmx script, the number of threads which are being started for each thread groups, thread termination reason and many more (especially if you increase JMeter logging verbosity to DEBUG level)

So my expectation is that

  1. Either you forgot to save your .jmx script
  2. Or you're running different script
  3. Or you're having previous results in the .jtl file and new results are basically getting appended to it, try adding -f option to your JMeter command line so it would remove the .jtl file instead of adding new metrics to it.

huangapple
  • 本文由 发表于 2023年6月26日 05:56:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/76552572.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定