在同一主机上运行多个jmeter服务器

时间:2020-04-29 01:43:16

标签: performance jmeter jmeter-4.0

我想以分布式方式运行JMeter。我的要求是,在我的从属计算机上应该运行多个jmeter-server进程。为此,我运行了以下命令。

./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]

我已检查并为所有TCP和UDP通信打开了端口1099、60001和60002。

有人可以帮忙吗?

2 个答案:

答案 0 :(得分:1)

以这种方式运行服务器:

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 :(得分:0)

  1. 您使用了错误的属性,需要修改server.rmi.port
  2. 您需要为不同的客户端引擎使用不同的端口,才能:

    • 启动从站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. 您的“需求”根本没有意义,因为在同一台计算机上拥有2个JMeter从属实例在性能上比拥有1个实例更糟糕

  4. According to JMeter best practices you should be using the latest version of JMeter,所以请考虑升级到JMeter 5.2.1

更多信息: