运行 带有 nohup 的 JMeter 脚本 "No such file or directory"

Running a JMeter script with nohup giving "No such file or directory"

运行 使用主从模型进行负载模拟,而 运行 使用 nohup 从命令行进行测试,给出 "No such file or directory".

所以我有两个 azure ubuntu 虚拟机(一个为主,一个为从)并通过腻子连接。在执行长 运行 负载测试时,我遇到了断电,测试被终止了。所以尝试使用 "nohup" 但出现 "No such file or directory" 错误。

我进入 Jmeter bin 目录后触发的以下命令

没有 "nohup" 的命令(在我的连接正常之前工作正常)

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01

已尝试使用 "nohup" 命令(无效)

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 &

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup "./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01" &

JVM_ARGS="-Xms1024m -Xmx2048m" && export JVM_ARGS && nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 > /home/performance/RunTest/test2.txt 2>&1 &

记住这些参数很重要,因为我有一个 Grafana 后端侦听器,它捕获所有这些数据和所有结果。

我也试过

nohup ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 </dev/null >nohup.out 2>nohup.err &

但是得到,

Creating summariser <summary>
Created the tree successfully using /home/performance/LoadTesting/Portal-8HR.jmx
Configuring remote engine: 192.168.2.32:1099
Starting distributed test with remote engines: [192.168.2.32:1099] @ Wed May 06 12:32:30 UTC 2020 (1588768350878)
Error in rconfigure() method java.rmi.MarshalException: error marshalling arguments; nested exception is:
        java.io.NotSerializableException: org.apache.jmeter.JMeter$ListenToTest
Remote engines have been started:[]
Waiting for possible Shutdown/StopTestNow/HeapDump/ThreadDump message on port 4446

我没有完全理解你想要实现的目标,你的命令的正确等价物应该是这样的:

nohup bash -c "JVM_ARGS=\"-Xms1024m -Xmx2048m\" && export JVM_ARGS && ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01 & ./jmeter -n -t /home/performance/LoadTesting/Portal-8HR.jmx -R 192.168.2.32:1099 -GTest_Name=LongDurationLoadTest -GTest_Triggered_By=LoadExecuter -Gtest_Id=200Con_8HR_Test01" 2>&1 &

如果唯一担心的是 putty 与 Linux Azure VM 之间的网络连接丢失,您可以在 Azure VM 端使用像 screen or tmux 这样的终端多路复用器,这样您就可以连接到运行 会话需要时从这台或另一台机器。

还有很多方法可以安排 Linux 作业,从最简单的 cron definitions, systemd timers or you can use a "heavy artillery" like Jenkins which allows flexible scheduling and kicking off jobs on other triggers. If you go for Jenkins you can enjoy the benefits of the Performance Plugin 开始,允许根据收到的测试指标将构建标记为失败或不稳定,并绘制性能趋势图