linux命令行上的Jmeter仅能运行有限数量的线程

时间:2018-09-05 12:35:29

标签: jmeter


我有一个jmeter测试计划,该计划已运行40000个线程,启动时间为600秒。 我正在用命令行运行它。

./jmeter -n -t ../../HttpTestPlan.jmx


它在Windows 64位计算机上运行良好。它能够执行所有40000个线程而没有任何问题。
但是,当我在ec2中运行同一测试计划(具有root特权)时,它只能执行31208个线程,然后它将停止执行。
我应该怎么做才能确保它在linux ec2 box上运行所有线程?
谢谢



    2018-09-05 08:04:58,148 INFO o.a.j.u.JMeterUtils: Setting Locale to en_EN
    2018-09-05 08:04:58,164 INFO o.a.j.JMeter: Loading user properties from: user.properties
    2018-09-05 08:04:58,165 INFO o.a.j.JMeter: Loading system properties from: system.properties
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: Copyright (c) 1998-2018 The Apache Software Foundation
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: Version 4.0 r1823414
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: java.version=1.8.0_181
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: java.vm.name=OpenJDK 64-Bit Server VM
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: os.name=Linux
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: os.arch=amd64
    2018-09-05 08:04:58,170 INFO o.a.j.JMeter: os.version=3.10.0-862.3.3.el7.x86_64
    2018-09-05 08:04:58,171 INFO o.a.j.JMeter: file.encoding=UTF-8
    2018-09-05 08:04:58,171 INFO o.a.j.JMeter: Max memory     =1073741824
    2018-09-05 08:04:58,171 INFO o.a.j.JMeter: Available Processors =2
    2018-09-05 08:04:58,175 INFO o.a.j.JMeter: Default Locale=English (EN)
    2018-09-05 08:04:58,175 INFO o.a.j.JMeter: JMeter  Locale=English (EN)
    2018-09-05 08:04:58,175 INFO o.a.j.JMeter: JMeterHome=/home/pardema/apache-jmeter-4.0
    2018-09-05 08:04:58,175 INFO o.a.j.JMeter: user.dir  =/home/pardema/apache-jmeter-4.0/bin
    2018-09-05 08:04:58,176 INFO o.a.j.JMeter: PWD       =/home/pardema/apache-jmeter-4.0/bin
    2018-09-05 08:04:58,180 INFO o.a.j.JMeter: IP: xxxxxxxxxx Name: xxxxxxxxxxx: xxxxxxxxxxxxxx
    2018-09-05 08:04:58,183 INFO o.a.j.s.FileServer: Default base='/home/pardema/apache-jmeter-4.0/bin'
    2018-09-05 08:04:58,189 INFO o.a.j.s.FileServer: Set new base='/home/pardema/apache-jmeter-4.0/bin/../..'
    2018-09-05 08:04:58,336 INFO o.a.j.s.SaveService: Testplan (JMX) version: 2.2. Testlog (JTL) version: 2.2
    2018-09-05 08:04:58,355 INFO o.a.j.s.SaveService: Using SaveService properties file encoding UTF-8
    2018-09-05 08:04:58,360 INFO o.a.j.s.SaveService: Using SaveService properties version 4.0
    2018-09-05 08:04:58,366 INFO o.a.j.s.SaveService: Loading file: ../../HttpTestPlan.jmx
    2018-09-05 08:04:58,409 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
    2018-09-05 08:04:58,409 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
    2018-09-05 08:04:58,409 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
    2018-09-05 08:04:58,409 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser
    2018-09-05 08:04:58,410 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser
    2018-09-05 08:04:58,410 INFO o.a.j.p.h.s.HTTPSamplerBase: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser
    2018-09-05 08:04:58,433 INFO o.a.j.JMeter: Creating summariser 
    2018-09-05 08:04:58,440 INFO o.a.j.e.StandardJMeterEngine: Running the test!
    2018-09-05 08:04:58,441 INFO o.a.j.s.SampleEvent: List of sample_variables: []
    2018-09-05 08:04:58,441 INFO o.a.j.s.SampleEvent: List of sample_variables: []
    2018-09-05 08:04:58,445 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must contain the string: '.functions.'
    2018-09-05 08:04:58,445 INFO o.a.j.e.u.CompoundVariable: Note: Function class names must not contain the string: '.gui.'
    2018-09-05 08:04:58,851 INFO o.a.j.JMeter: Running test (1536149098851)
    2018-09-05 08:04:58,890 INFO o.a.j.e.StandardJMeterEngine: Starting ThreadGroup: 1 : Thread Group
    2018-09-05 08:04:58,891 INFO o.a.j.e.StandardJMeterEngine: Starting 50000 threads for group Thread Group.
    2018-09-05 08:04:58,891 INFO o.a.j.e.StandardJMeterEngine: Thread will continue on error
    2018-09-05 08:04:58,891 INFO o.a.j.t.ThreadGroup: Starting thread group... number=1 threads=50000 ramp-up=600 perThread=12.0 delayedStart=false
    2018-09-05 08:04:58,900 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-1
    2018-09-05 08:04:58,913 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-2
    2018-09-05 08:04:58,919 INFO o.a.j.p.h.s.HTTPHCAbstractImpl: Local host = 10-118-9-93.ebiz.verizon.com
    2018-09-05 08:04:58,925 INFO o.a.j.p.h.s.HTTPHC4Impl: HTTP request retry count = 0
    2018-09-05 08:04:58,932 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-3
    2018-09-05 08:04:58,933 INFO o.a.j.s.SampleResult: Note: Sample TimeStamps are START times
    2018-09-05 08:04:58,933 INFO o.a.j.s.SampleResult: sampleresult.default.encoding is set to ISO-8859-1
    2018-09-05 08:04:58,933 INFO o.a.j.s.SampleResult: sampleresult.useNanoTime=true
    2018-09-05 08:04:58,933 INFO o.a.j.s.SampleResult: sampleresult.nanoThreadSleep=5000
    2018-09-05 08:04:58,946 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-4
    2018-09-05 08:04:58,950 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-5
    2018-09-05 08:04:58,962 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-6
    2018-09-05 08:04:58,975 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-7
    2018-09-05 08:04:59,001 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-9
    2018-09-05 08:04:59,006 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-8
    2018-09-05 08:04:59,026 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-10
    2018-09-05 08:04:59,026 INFO o.a.j.t.JMeterThread: Thread started: Thread Group 1-11

2 个答案:

答案 0 :(得分:0)

您可能需要修改/proc/sys/kernel/threads-max设置

也请检查limits.conf,因为您可能需要增加打开手柄的最大数量

请注意,对于单个JMeter引擎而言,40k线程是相当大的数量,因此您可能需要考虑Distributed Testing,确保机器具有足够的空间来运行CPU,RAM,网络,磁盘IO等,就好像JMeter无法足够快地发送请求一样,即使您的应用程序不会超载并坚持使用JMeter Best Practices,吞吐量也会降低。

答案 1 :(得分:0)

很可能是由于JVM崩溃而生成了一个hs_err_pid.log文件。 搜索此类文件以查找JVM崩溃的根本原因。

假说中

  • Linux内存,进程,文件描述符限制
  • 系统内存不足

请注意,40k线程需要一台强大的机器,并且很可能需要一个以上的机器才能克服: -卡的网络限制 - 中央处理器 -需要其他资源

您的机器(2个CPU,1Gb RAM)非常短。