【问题标题】:why does JMeter create so many threads in a load test?为什么 JMeter 在负载测试中创建这么多线程?
【发布时间】:2017-05-10 22:20:46
【问题描述】:

我有一些 JMeter 测试,它们都同时从命令行运行。 这些具有作为属性文件 (users_concurrent.properties) 传入的用户数。

例如:

C:/applications/apache-jmeter-3.0/bin/jmeter.bat -n -t RDA_CAEventMaintenance.jmx -l UK_RDA_CAEventMaintenance.jtl -q dev_uk.properties -q users_concurrent.properties 

对于大多数这些测试,这会运行 5 个测试线程(在结果文件和线程转储中都经过验证)。 然而,其中 2 个测试耗尽了内存并创建了 hprof.pid 转储文件。

分析这些文件显示大约 100 个线程占用了超过一半的堆:

这是一个 JMeter 错误吗?当我指定 5 时,它不应该启动那么多线程。

使用 JMeter 3.0

【问题讨论】:

    标签: java multithreading jmeter out-of-memory load-testing


    【解决方案1】:

    调查

    线程组 1 - 100

    看来您至少有 100 个线程。您可以在 jmeter.log 文件中仔细检查它,查找如下行:

    开始线程组... number=1 threads=XXX

    因此,您要么以错误的方式定义或引用代表线程数的属性。正确的配置示例是:

    1. 在 JMeter 线程组下使用 __P() function 定义虚拟用户数

      ${__P(threads,)}
      
    2. 确保您的 users_concurrent.properties 文件包含以下行(并且该行仅出现一次)

      threads=5
      

    为了以防万一,请确保您关注JMeter Best Practices9 Easy Solutions for a JMeter Load Test “Out of Memory” Failure 的建议

    【讨论】:

      猜你喜欢
      • 2021-10-03
      • 2021-08-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-09-30
      • 1970-01-01
      相关资源
      最近更新 更多