Jmeter4.x压测常见问题处理

发布于 2020-08-10  1,232 次阅读


问题一

[root@iZwz95j86y235aroi85ht0Z bin]# ./jmeter-serverCreated remote object: UnicastServerRef2 [liveRef: [endpoint:[:39308](local),objID:[24e78a63:16243c70661:-7fff, 7492480871343944173]]]Server failed to start: java.rmi.RemoteException: Cannot start. Unable to get local host IP address.; nested exception is:java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not knownAn error occurred: Cannot start. Unable to get local host IP address.; nested exception is:java.net.UnknownHostException: iZwz95j86y235aroi85ht0Z: iZwz95j86y235aroi85ht0Z: Name or service not known

解决:hostname  命令获取机器名称,追加一个映射  iZwz95j86y235aroi85ht0Zvim /etc/hosts127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4::1         localhost localhost.localdomain localhost6 localhost6.localdomain6120.79.160.143 iZwz95j86y235aroi85ht0Zwindows用户 修改c:\windows\system32\drivers\etc\hosts文件,增加一条域名 与IP的映射

问题二

[root@iZwz95j86y235aroi85ht0Z bin]# ./jmeter-serverServer failed to start: java.rmi.server.ExportException: Listen failed on port: 0; nested exception is:java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)An error occurred: Listen failed on port: 0; nested exception is:java.io.FileNotFoundException: rmi_keystore.jks (No such file or directory)   解决:   拥有RMI over SSL的有效密钥库,或者禁用了SSL。   1、禁用SSL   jmeter.property里面 server.rmi.ssl.disable 改为 true,表示禁用

问题三

[root@iZ949uw2xehZ bin]# ./jmeterJava HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x00000000c0000000, 1073741824, 0) failed; error='Cannot allocate memory' (errno=12)## There is insufficient memory for the Java Runtime Environment to continue.# Native memory allocation (mmap) failed to map 1073741824 bytes for committing reserved memory.# An error report file with more information is saved as:# /usr/local/jmeter/apache-jmeter-4.0/bin/hs_err_pid5855.log

解决:编辑jmeter搜索 : "${HEAP:="-Xms1g -Xmx1g -XX:MaxMetaspaceSize=256m"}"改变初始堆内存和最大堆内存

问题四-端口配置

仅修改 server_port 即可,下面两者一样server.rmi.localport=8899 表示slave server启动显示的端口server_port=8899  表示master机器要远程连接的端口   即 remote_hosts=xxxx:8899

问题五-分布式配置

<!-- jmeter 分布式性能测试(多网卡配置) -->我们要在多网卡的服务器上开启RMI服务的话必须指定IP,使他们能够在同一个网段内。 

需要以下几步(假定所有机器都在10.120.11.*网段,agent服务器为linux,controller服务器为windows(mac)):

1、 修改agent服务器,指定agent机器的IP修改jmeter-server文件# vi jmeter-server修改RMI_HOST_DEF=-Djava.rmi.server.hostname=xxx.xxx.xxx.xxx(需要连接的IP)

2、修改server服务器,指定server机器的IP

修改jmeter.bat文件 

新增set rmi_host=-Djava.rmi.server.hostname=10.120.11.214

修改set ARGS=%DUMP% %HEAP% %NEW% %SURVIVOR% %TENURING% %PERM% %DDRAW% %rmi_host%

问题六

确定在controller机器上安装jdk,版本和jmeter一致,配置环境变量:Java_home等   在Agent机器上安装jdk,配置环境变量:Java_home和JMeter_home   安装目录不要带空格,最好都是简短的英文路径

问题七

master机器启动后会拷贝jmx文件到slave机器,所以不需要在每台slave机器上也上传一份jmx,只需要在master机器上上传一份jmx脚本即可。
如果使用csv进行参数化,则需要把参数文件在每台slave上拷一份且路径需要设置成一样的。
总样本数 = 线程数 * 循环次数 * 执行机总数

问题八-连接失败原因排查以下步骤进行排查:

1. jmeter-server是否启动;

2. 是否联网

3. ping 服务器IP是否畅通.

4. telnet 端口 192.168.3.10 1099

5. 检查服务器的防火墙是否关闭。

6. 阿里云安全策略是否正常


问题九

"could not find ApacheJmeter_core.jar"

解决:在Agent机器安装jdk,并设置环境变量

问题十

”Bad call to remote host

"解决:检查被控制机器上的jmeter-server有没有启动,或者remote_hosts的配置是否正确。

问题十一

启动远程执行的时候报Error in rconfigure() method java.rmi.MarshalException: error marshalling ar

解决:slave节点启动的时候用以下命令启动jmeter-server -Djava.rmi.server.hostname=10.0.7.11,或者在jmeter.properties配置文件中添加RMI_HOST_DEF=-Djava.rmi.server.hostname=10.0.7.11

问题十二

Non HTTP response code: java.net.SocketException

Following setting to be used:

1. bin folder - user.properties : httpclient4.retrycount=1 and hc.parameters.file=hc.parameters

2. bin folder - hc.parameters : http.connection.stalecheck$Boolean=true

3. Thread Group - Http request sampler - unchecked “Use Keep alive” also (as authentication takes more than 10 minutes for 100 users and above and I am not interested that how much time this authentication takes place)

问题十三

分布式执行,java.rmi.ConnectException: Connection refused to host: 127.0.1.1; nested exception is

解决:在master主机system.properties 文件最后一行添加java.rmi.server.hostname=xxx.xxx.xxx.xxx (master ip)


一名测试工作者,专注接口测试、自动化测试、性能测试、Python技术。