博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
jmeter3000用户压测_jmeter集群压测搭建
阅读量:6280 次
发布时间:2019-06-22

本文共 13608 字,大约阅读时间需要 45 分钟。

准备: 1:一台调度机(windows GUI),因为windows图形界面方便看压测监控信息

2:N台执行机(linux)

3:csv参数文件的配置

在整个过程中遇到一个比较棘手的问题:执行访问不到csv参数文件。

------------分析:

因为测试脚本jmx文件只需要放在调度机上,搭建好集群后,调度机会自动同步测试脚本到执行机上。 但调度机是windows环境,执行机是linux环境,会出现csv所在的目录不一致。从而在执行机执行脚本的时候会出现如下错误:

2017-10-31 17:29:14,133 INFO o.a.j.t.JMeterThread: Thread started: 线程组 1-1

2017-10-31 17:29:14,134 INFO o.a.j.s.FileServer: Stored: \2017\flowproduct.csv

2017-10-31 17:29:14,134 ERROR o.a.j.t.JMeterThread: Test failed!

java.lang.IllegalArgumentException: File \2017\flowproduct.csv must exist and be readable

at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:430) ~[ApacheJMeter_core.jar:3.3 r1808647]

at org.apache.jmeter.services.FileServer.readLine(FileServer.java:346) ~[ApacheJMeter_core.jar:3.3 r1808647]

at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:203) ~[ApacheJMeter_components.jar:3.3 r1808647]

at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:393) ~[ApacheJMeter_core.jar:3.3 r1808647]

at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:385) ~[ApacheJMeter_core.jar:3.3 r1808647]

at org.apache.jmeter.control.GenericController.next(GenericController.java:158) ~[ApacheJMeter_core.jar:3.3 r1808647]

at org.apache.jmeter.control.LoopContr

-----------解决方法:

一句话:在执行机看启动的日志,找到jmeter.JMeter:user.dir输出项的配置值(用户目录)。

例如:我们在执行机上将jmeter安装在/opt/haitao/jemter目录。我们写了一个启动jmeter的脚本jmeter.sh文件。这个jmeter.sh就需要放在user.dir目录下。

即:调度机将执行文件自动发送到执行机启动的那个目录下

1:我们启动jmeter.sh的时候发现user.dir=/home/admin,那我们就需要将jmeter.sh移到/home/admin下

2:将jmeter.sh移到/home/admin下

3:jmeter.sh的内容

前些天,在进行分布式参数化测试的时候,出现了如题所示的错误报错信息。此文,针对此做一个简略的重现及分析说明。

JMX脚本线程组参数配置如下所示:

参数文件路径配置如下所示:

执行JMX脚本后,服务器对应日志错误信息(部分)输出如下所示:

综上,如下两种情况下,测试脚本参数化均无法按照预期正确执行:

参数文件路径为绝对路径,但对应路径下不存在

参数文件路径为相对路径,但对应执行机(Slave)服务分发路径下不存在

那么,调度机(Controller)分发脚本到执行机(Slave)的路径是什么呢?查看脚本分发路径有如下两种方式:

一、通过执行机服务日志,user.dir 目录即为分发路径(推荐)

二、分发jmx脚本目录即为执行机服务启动目录,例如执行机服务启动命令行如下所示:

那么,此执行机对应的jmx脚本分发目录为:D:\DevTool\apache-jmeter-3.0\bin

执行JMX测试脚本

第一次,对应分发路径无对应参数文件

第二次,对应分发路径有对应参数文件

执行机(Slave)端控制台输出如下所示:

JMX脚本两次执行结果如下所示:

由执行结果可见,将 JMX 脚本对应参数文件放到正确的目录后,脚本成功执行。

附录:执行机(Slave)日志输出如下所示:

1 2016/06/20 15:01:47 INFO -jmeter.util.JMeterUtils: Setting Locale to zh_CN2 2016/06/20 15:01:47 INFO - jmeter.JMeter: Loading user properties from: D:\DevTool\apache-jmeter-3.0\bin\user.properties3 2016/06/20 15:01:47 INFO - jmeter.JMeter: Loading system properties from: D:\DevTool\apache-jmeter-3.0\bin\system.properties4 2016/06/20 15:01:47 INFO - jmeter.JMeter: Copyright (c) 1998-2016The Apache Software Foundation5 2016/06/20 15:01:47 INFO - jmeter.JMeter: Version 3.0r17438076 2016/06/20 15:01:47 INFO - jmeter.JMeter: java.version=1.8.0_667 2016/06/20 15:01:47 INFO - jmeter.JMeter: java.vm.name=Java HotSpot(TM) 64-Bit Server VM8 2016/06/20 15:01:47 INFO - jmeter.JMeter: os.name=Windows 7

9 2016/06/20 15:01:47 INFO - jmeter.JMeter: os.arch=amd6410 2016/06/20 15:01:47 INFO - jmeter.JMeter: os.version=6.1

11 2016/06/20 15:01:47 INFO - jmeter.JMeter: file.encoding=GBK12 2016/06/20 15:01:47 INFO - jmeter.JMeter: Max memory =523763712

13 2016/06/20 15:01:47 INFO - jmeter.JMeter: Available Processors =4

14 2016/06/20 15:01:47 INFO - jmeter.JMeter: Default Locale=中文 (中国)15 2016/06/20 15:01:47 INFO - jmeter.JMeter: JMeter Locale=中文 (中国)16 2016/06/20 15:01:47 INFO - jmeter.JMeter: JMeterHome=D:\DevTool\apache-jmeter-3.0

17 2016/06/20 15:01:47 INFO - jmeter.JMeter: user.dir =D:\DevTool\apache-jmeter-3.0\bin18 2016/06/20 15:01:47 INFO - jmeter.JMeter: PWD =D:\DevTool\apache-jmeter-3.0\bin19 2016/06/20 15:01:47 INFO - jmeter.JMeter: IP: 10.9.215.47Name: TEST FullName: TEST.ffp.corp20 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: Starting backing engine on 1029

21 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: System property 'java.rmi.server.hostname'is not defined, using localHost address22 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: Local IP address=10.9.215.47

23 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: IP address is a site-local address; thismay cause problems with remote access.24 Can be overridden by defining the system property 'java.rmi.server.hostname' - see jmeter-server script file25 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: Creating RMI registry (server.rmi.create=true)26 2016/06/20 15:01:47 INFO - jmeter.engine.RemoteJMeterEngineImpl: Bound to registry on port 1029

27 2016/06/20 15:05:55 INFO -jmeter.samplers.SampleEvent: List of sample_variables: []28 2016/06/20 15:05:55 INFO - jmeter.samplers.BatchSampleSender: Using batching for this run. Thresholds: num=100, time=60000

29 2016/06/20 15:05:55 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for thisrun30 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/html is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser31 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xhtml+xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser32 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for application/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser33 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/xml is org.apache.jmeter.protocol.http.parser.LagartoBasedHtmlParser34 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/vnd.wap.wml is org.apache.jmeter.protocol.http.parser.RegexpHTMLParser35 2016/06/20 15:05:55 INFO - jmeter.protocol.http.sampler.HTTPSamplerBase: Parser for text/css is org.apache.jmeter.protocol.http.parser.CssParser36 2016/06/20 15:05:56 INFO - jmeter.engine.RemoteJMeterEngineImpl: Creating JMeter engine on host 10.9.215.47:1029 base '.'

37 2016/06/20 15:05:56 INFO - jmeter.engine.RemoteJMeterEngineImpl: Remote client host: 10.9.215.49

38 2016/06/20 15:05:56 INFO - jmeter.services.FileServer: Default base='D:\DevTool\apache-jmeter-3.0\bin'

39 2016/06/20 15:05:56 INFO - jmeter.services.FileServer: Set new base='.'

40 2016/06/20 15:05:56 INFO -jmeter.engine.StandardJMeterEngine: Applying properties {}41 2016/06/20 15:05:56 INFO -jmeter.engine.RemoteJMeterEngineImpl: Running test42 2016/06/20 15:05:56 INFO - jmeter.engine.StandardJMeterEngine: Running the test!

43 2016/06/20 15:05:56 INFO -jmeter.samplers.SampleEvent: List of sample_variables: []44 2016/06/20 15:05:56 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must contain the string: '.functions.'

45 2016/06/20 15:05:56 INFO - jmeter.engine.util.CompoundVariable: Note: Function class names must not contain the string: '.gui.'

46 2016/06/20 15:05:56 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1: 文章详情47 2016/06/20 15:05:56 INFO - jmeter.engine.StandardJMeterEngine: Starting 2 threads forgroup 文章详情.48 2016/06/20 15:05:56 INFO - jmeter.engine.StandardJMeterEngine: Thread will continueon error49 2016/06/20 15:05:56 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 2 ramp-up 2 perThread 1000.0 delayedStart=false

50 2016/06/20 15:05:56 INFO - jmeter.threads.ThreadGroup: Started thread group number 1

51 2016/06/20 15:05:56 INFO -jmeter.engine.StandardJMeterEngine: All thread groups have been started52 2016/06/20 15:05:56 INFO - jmeter.threads.JMeterThread: Thread started: 文章详情 1-1

53 2016/06/20 15:05:56 INFO - jmeter.services.FileServer: Stored: ./distributed.csv54 2016/06/20 15:05:56 ERROR - jmeter.threads.JMeterThread: Test failed!java.lang.IllegalArgumentException: File distributed.csv must exist and be readable55 at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:422)56 at org.apache.jmeter.services.FileServer.readLine(FileServer.java:347)57 at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:198)58 at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:405)59 at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:397)60 at org.apache.jmeter.control.GenericController.next(GenericController.java:158)61 at org.apache.jmeter.control.LoopController.next(LoopController.java:123)62 at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:87)63 at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:239)64 at java.lang.Thread.run(Unknown Source)65

66 2016/06/20 15:05:56 INFO - jmeter.threads.JMeterThread: Thread finished: 文章详情 1-1

67 2016/06/20 15:05:57 INFO - jmeter.threads.JMeterThread: Thread started: 文章详情 1-2

68 2016/06/20 15:05:57 ERROR - jmeter.threads.JMeterThread: Test failed!java.lang.IllegalArgumentException: File distributed.csv must exist and be readable69 at org.apache.jmeter.services.FileServer.createBufferedReader(FileServer.java:422)70 at org.apache.jmeter.services.FileServer.readLine(FileServer.java:347)71 at org.apache.jmeter.config.CSVDataSet.iterationStart(CSVDataSet.java:198)72 at org.apache.jmeter.control.GenericController.fireIterationStart(GenericController.java:405)73 at org.apache.jmeter.control.GenericController.fireIterEvents(GenericController.java:397)74 at org.apache.jmeter.control.GenericController.next(GenericController.java:158)75 at org.apache.jmeter.control.LoopController.next(LoopController.java:123)76 at org.apache.jmeter.threads.AbstractThreadGroup.next(AbstractThreadGroup.java:87)77 at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:239)78 at java.lang.Thread.run(Unknown Source)79

80 2016/06/20 15:05:57 INFO - jmeter.threads.JMeterThread: Thread finished: 文章详情 1-2

81 2016/06/20 15:05:57 INFO -jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test82 2016/06/20 15:05:57 INFO - jmeter.samplers.DataStrippingSampleSender: Test Ended on 10.9.215.47:1029

83 2016/06/20 15:05:57 INFO - jmeter.samplers.BatchSampleSender: Test Ended on 10.9.215.47:1029

84 2016/06/20 15:05:57 INFO - jmeter.engine.StandardJMeterEngine: Test has ended on host 10.9.215.47:1029

85 2016/06/20 15:07:51 INFO - jmeter.samplers.BatchSampleSender: Using batching for this run. Thresholds: num=100, time=60000

86 2016/06/20 15:07:51 INFO - jmeter.samplers.DataStrippingSampleSender: Using DataStrippingSampleSender for thisrun87 2016/06/20 15:07:51 INFO - jmeter.engine.RemoteJMeterEngineImpl: Creating JMeter engine on host 10.9.215.47:1029 base '.'

88 2016/06/20 15:07:51 INFO - jmeter.engine.RemoteJMeterEngineImpl: Remote client host: 10.9.215.49

89 2016/06/20 15:07:51 INFO - jmeter.services.FileServer: Set new base='.'

90 2016/06/20 15:07:51 INFO -jmeter.engine.RemoteJMeterEngineImpl: Cleaning previously set properties {}91 2016/06/20 15:07:51 INFO -jmeter.engine.StandardJMeterEngine: Applying properties {}92 2016/06/20 15:07:51 INFO -jmeter.engine.RemoteJMeterEngineImpl: Running test93 2016/06/20 15:07:51 INFO - jmeter.engine.StandardJMeterEngine: Running the test!

94 2016/06/20 15:07:51 INFO -jmeter.samplers.SampleEvent: List of sample_variables: []95 2016/06/20 15:07:51 INFO - jmeter.engine.StandardJMeterEngine: Starting ThreadGroup: 1: 文章详情96 2016/06/20 15:07:51 INFO - jmeter.engine.StandardJMeterEngine: Starting 2 threads forgroup 文章详情.97 2016/06/20 15:07:51 INFO - jmeter.engine.StandardJMeterEngine: Thread will continueon error98 2016/06/20 15:07:51 INFO - jmeter.threads.ThreadGroup: Starting thread group number 1 threads 2 ramp-up 2 perThread 1000.0 delayedStart=false

99 2016/06/20 15:07:51 INFO - jmeter.threads.JMeterThread: Thread started: 文章详情 1-1

100 2016/06/20 15:07:51 INFO - jmeter.threads.ThreadGroup: Started thread group number 1

101 2016/06/20 15:07:51 INFO -jmeter.engine.StandardJMeterEngine: All thread groups have been started102 2016/06/20 15:07:51 INFO - jmeter.services.FileServer: Stored: ./distributed.csv103 2016/06/20 15:07:52 INFO - jmeter.threads.JMeterThread: Thread started: 文章详情 1-2

104 2016/06/20 15:07:54 WARN - jmeter.timers.SyncTimer: SyncTimer 集合点 timeouted waiting forusers after:3000ms105 2016/06/20 15:07:54 INFO - jmeter.protocol.http.sampler.HTTPHCAbstractImpl: Local host =TEST106 2016/06/20 15:07:54 INFO - jmeter.protocol.http.sampler.HTTPHC4Impl: HTTP request retry count = 0

107 2016/06/20 15:07:54 INFO -jmeter.samplers.SampleResult: Note: Sample TimeStamps are START times108 2016/06/20 15:07:54 INFO - jmeter.samplers.SampleResult: sampleresult.default.encoding is set to ISO-8859-1

109 2016/06/20 15:07:54 INFO - jmeter.samplers.SampleResult: sampleresult.useNanoTime=true

110 2016/06/20 15:07:54 INFO - jmeter.samplers.SampleResult: sampleresult.nanoThreadSleep=5000

111 2016/06/20 15:07:55 INFO - jmeter.threads.JMeterThread: Thread is done: 文章详情 1-1

112 2016/06/20 15:07:55 INFO - jmeter.threads.JMeterThread: Thread finished: 文章详情 1-1

113 2016/06/20 15:07:55 INFO - jmeter.threads.JMeterThread: Thread is done: 文章详情 1-2

114 2016/06/20 15:07:55 INFO - jmeter.threads.JMeterThread: Thread finished: 文章详情 1-2

115 2016/06/20 15:07:55 INFO -jmeter.engine.StandardJMeterEngine: Notifying test listeners of end of test116 2016/06/20 15:07:55 INFO - jmeter.services.FileServer: Close: ./distributed.csv117 2016/06/20 15:07:55 INFO - jmeter.samplers.DataStrippingSampleSender: Test Ended on 10.9.215.47:1029

118 2016/06/20 15:07:55 INFO - jmeter.samplers.BatchSampleSender: Test Ended on 10.9.215.47:1029

119 2016/06/20 15:07:55 INFO - jmeter.engine.StandardJMeterEngine: Test has ended on host 10.9.215.47:1029

执行机(Slave)服务日志信息

至此,此文顺利完结,希望此文能够给初学 JMeter 的您一份参考。

最后,非常感谢亲的驻足,希望此文能对亲有所帮助。热烈欢迎亲一起探讨,共同进步。非常感谢! ^_^

转载地址:http://hrjva.baihongyu.com/

你可能感兴趣的文章
ExtJs中column与form布局的再次领悟
查看>>
asp.net MVC2 初探十一
查看>>
C++/CLI思辨录之Object的对象布局
查看>>
Windows 7优化调整使用小技巧
查看>>
使用 “Unicode 字符集 ” 使用错误,应该使用 “使用多字节字符集”
查看>>
C中如何实现C++中的默认参数?
查看>>
某直播App问题分析
查看>>
InnoDB引擎的索引和存储结构
查看>>
Selenium私房菜系列8 -- 玩转Selenium Server
查看>>
重学自动控制 PID
查看>>
游戏演示(包含源码)[名称待定]
查看>>
浅析SQL Server实现分布式事务的两阶段提交协议2PC
查看>>
IBM WebSphere 产品介绍
查看>>
结构型模式之Adapter模式
查看>>
仅用18天,英伟达新型GAN合成真假难辨高清明星脸
查看>>
C# 泛型编程之泛型类、泛型方法、泛型约束
查看>>
MAT文件操作
查看>>
【英语天天读】Heart of a stranger 陌生的心灵
查看>>
wp7 Emulator模拟器停止工作原因
查看>>
iBATIS.net直接执行sql语句
查看>>