运行 同一主机上的多个 jmeter-server

Running multiple jmeter-server on same host

我想运行 JMeter 以分布式方式。我的要求是在我的从机上应该有多个 jmeter-server 进程 运行ning。为了做到这一点,我 运行 下面的命令。

./jmeter-server -Djava.rmi.server.hostname=XX.XX.X.XXX -Dserver.rmi.localport=60001

./jmeter-server -Djava.rmi.server.hostname=XX.XX.X.XXX -Dserver.rmi.localport=60001

每次我 运行 这个命令时,我都会在控制台上看到以下消息。同样的错误是端口 60002

Created remote object: UnicastServerRef2 [liveRef: [endpoint:[XX.XX.X.XXX:60001](local),objID:[-823e97d:171c37a0bf7:-7fff, -7549432026360676360]]]


Created remote object: UnicastServerRef2 [liveRef: [endpoint:[XX.XX.X.XXX:60002](local),objID:[7b7158d6:171c37bd76f:-7fff, 2942891814894680180]]]

在主服务器上,远程服务器配置为 XX.XX.X.XXX:60001 和 XX.XX.X.XXX:60002。但是每次我 运行 测试都会出现以下错误。

2020-04-29 01:26:03,052 ERROR o.a.j.e.DistributedRunner: Failed to create engine at XX.XX.X.XXX:60001
java.rmi.NoSuchObjectException: no such object in table
    at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:283) ~[?:1.8.0_212]
    at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:260) ~[?:1.8.0_212]
    at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:375) ~[?:1.8.0_212]
    at sun.rmi.registry.RegistryImpl_Stub.lookup(RegistryImpl_Stub.java:119) ~[?:1.8.0_212]
    at org.apache.jmeter.engine.ClientJMeterEngine.getEngine(ClientJMeterEngine.java:70) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.ClientJMeterEngine.<init>(ClientJMeterEngine.java:83) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.createEngine(DistributedRunner.java:237) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.getClientEngine(DistributedRunner.java:213) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.engine.DistributedRunner.init(DistributedRunner.java:93) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.runNonGui(JMeter.java:1011) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.startNonGui(JMeter.java:915) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.start(JMeter.java:543) [ApacheJMeter_core.jar:4.0 r1823414]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
    at org.apache.jmeter.NewDriver.main(NewDriver.java:245) [ApacheJMeter.jar:4.0 r1823414]
2020-04-29 01:26:03,056 ERROR o.a.j.u.JMeterUtils: no such object in table
2020-04-29 01:26:03,056 INFO o.a.j.e.DistributedRunner: Failed to configure XX.XX.X.XXX:60001
2020-04-29 01:26:03,056 INFO o.a.j.e.DistributedRunner: Stopping remote engines
2020-04-29 01:26:03,056 INFO o.a.j.e.DistributedRunner: Remote engines have been stopped
2020-04-29 01:26:03,056 ERROR o.a.j.JMeter: Error in NonGUIDriver
java.lang.RuntimeException: Following remote engines could not be configured:[XX.XX.X.XXX:60001]
    at org.apache.jmeter.engine.DistributedRunner.init(DistributedRunner.java:112) ~[ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.runNonGui(JMeter.java:1011) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.startNonGui(JMeter.java:915) [ApacheJMeter_core.jar:4.0 r1823414]
    at org.apache.jmeter.JMeter.start(JMeter.java:543) [ApacheJMeter_core.jar:4.0 r1823414]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_212]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_212]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_212]
    at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_212]
    at org.apache.jmeter.NewDriver.main(NewDriver.java:245) [ApacheJMeter.jar:4.0 r1823414]

我已经检查过,端口 1099、60001 和 60002 对所有 TCP 和 UDP 流量都是开放的。

有人可以帮忙吗?

运行 这样的服务器:

jmeter -Dserver_port=60001 -s -j jmeter-server1.log -Djava.rmi.server.hostname=XX.XX.X.XXX


jmeter -Dserver_port=60002 -s -j jmeter-server1.log -Djava.rmi.server.hostname=XX.XX.X.XXX

然后控制器这样:

jmeter -R -Jremote_hosts=XX.XX.X.XXX:60001,XX.XX.X.XXX:60002 -n -t Testplan.jmx -l results.csv -e -o reportfolder

阅读此 tutorial 了解更多详情。

如果您想正确学习 jmeter,这篇 book 会对您有所帮助。

  1. 你用错了属性,需要修改server.rmi.port
  2. 不同的客户端引擎需要使用不同的端口,即:

    • 启动slave 1:

      jmeter-server -Djava.rmi.server.hostname=127.0.0.1 -Dserver.rmi.port=60001
      
    • 启动从机 2:

      jmeter-server -Djava.rmi.server.hostname=127.0.0.1 -Dserver.rmi.port=60002
      
    • 启动大师:

      jmeter -Jremote_hosts=127.0.0.1:60001,127.0.0.1:60002 -r -n -t test.jmx -l result.jtl
      

    127.0.0.1 替换为您拥有从实例的计算机的 IP 地址(如果它与主实例不同)

  3. 你的 "requirement" 根本没有意义,因为在同一台机器上有 2 个 JMeter 从属实例在性能方面比有 1 个实例更差

  4. According to JMeter best practices you should be using the latest version of JMeter so consider upgrading to JMeter 5.2.1

更多信息: