在,jmeter.bat文件,用sublime打开,修改HEAP="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m ,理论上内存不超过物理内存一半
最大内存设置是否成功看:C:\Program Files\Java\jdk1.8.0_261\bin文件下jconsole.exe ,vm中,参数是否有显示,有的话则设置正确(jmeter要先启动,设置完不一定马上生效,我是隔天过来看才生效的)
压测的时候禁用查看结果树 (先看下运行的时候点查看结果树是不是会死掉,可能是这占用了太多资源的原因)
这2点设置下,然后跑下jmeter看是不是真的有用
官方说:运行在2-3GHz CPU(最近的CPU)上的单个jmeter客户端可以根据测试类型处理1000-2000个线程。 线程再多就就得加机器了(官网:http://jmeter.apache.org/usermanual/jmeter_distributed_testing_step_by_step.html)
命令行执行jmx,在jmeter安装目录下:cmd执行
>D:\INSTALL\apache-jmeter-5.3>jmeter -n -t C:\Users\Mloong\Desktop\tuangou\1.获取秒杀列表.jmx -l C:\Users\Mloong\Desktop\tuangou\r\1.jtl -e -o C:\Users\Mloong\Desktop\tuangou\r
-n:用命令行执行
-t:执行的jmx文件路径名称
-l:执行后生成的jtl文件
-e:生成测试报告
-o:生成测试报告路径
备注:生成测试报告的文件夹要是空的,否则会报错
jmx需要是能成功执行的否则会报空指针异常
jmeter.properties文件要先设置为:
jmeter.save.saveservice.output_format=csv
jmeter.save.saveservice.label=true
jmeter.save.saveservice.response_code=true
# response_data is not currently supported for CSV output
jmeter.save.saveservice.response_data=true
# Save ResponseData for failed samples
jmeter.save.saveservice.response_data.on_error=false
jmeter.save.saveservice.response_message=true
jmeter.save.saveservice.successful=true
jmeter.save.saveservice.thread_name=true
jmeter.save.saveservice.time=true
jmeter.save.saveservice.subresults=true
jmeter.save.saveservice.assertions=true
jmeter.save.saveservice.latency=true
jmeter.save.saveservice.connect_time=true
jmeter.save.saveservice.samplerData=true
jmeter.save.saveservice.responseHeaders=true
jmeter.save.saveservice.requestHeaders=true
jmeter.save.saveservice.encoding=false
jmeter.save.saveservice.bytes=true
# Only available with HttpClient4
#jmeter.save.saveservice.sent_bytes=true
jmeter.save.saveservice.url=true
jmeter.save.saveservice.filename=true
jmeter.save.saveservice.hostname=true
jmeter.save.saveservice.thread_counts=true
jmeter.save.saveservice.sample_count=true
jmeter.save.saveservice.idle_time=true
# Timestamp format - this only affects CSV output files
# legitimate values: none, ms, or a format suitable for SimpleDateFormat
jmeter.save.saveservice.timestamp_format=ms
jmeter.save.saveservice.timestamp_format=yyyy/MM/dd HH:mm:ss