当 运行 运行 作为远程服务器时 JMeter 的配置文件性能

Profile performance of JMeter when running running as a remote server

当 运行 JMeter 在我的桌面上时,我可以在执行负载测试时使用 VisualVM 来监视 JMeter 的特性。

JMeter VisualVM

但是,当我在远程服务器上设置 JMeter 并使用 jstatd 运行 时,我没有在该服务器下看到我的应用程序。我可以使用以下命令查看 jstatd 运行:

root@jmeter:~# netstat -nlp | grep jstatd
tcp6       0      0 :::39337                :::*                    LISTEN      8410/jstatd     
tcp6       0      0 :::1099                 :::*                    LISTEN      8410/jstatd  

有人成功设置了这个吗?我可以盲目增加 JVM 属性,但我想看看我的 jmeter 测试如何执行。

使用 jstatd 尝试此处提到的步骤:

Remote Monitoring VisualVM using jstatd

作为替代方案,您可以尝试使用 JMX:

enable remote monitoring using JMX

来自jstatd description

Monitors Java Virtual Machines (JVMs) and enables remote monitoring tools to attach to JVMs. This command is experimental and unsupported.

我建议切换到相同的 "jvisualvm" 方法,但根据 Monitoring and Management Using JMX Technology 指南远程而不是本地连接到 JMeter 实例。

  1. 将以下行添加到 system.properties 文件(位于 JMeter 的 "bin" 文件夹中)

    java.rmi.server.hostname=remote_machine_IP_here   
    com.sun.management.jmxremote.host=remote_machine_IP_here
    com.sun.management.jmxremote.port=remote_machine_PORT_here
    com.sun.management.jmxremote.rmi.portremote_machine_PORT_here
    com.sun.management.jmxremote.authenticate=false
    com.sun.management.jmxremote.local.only=false
    com.sun.management.jmxremote.ssl=false
    
  2. 重新启动 JMeter 以获取属性。 (设置 Java 系统属性的另一种方法是通过 -D 参数将它们传递给 JMeter 启动脚本,例如:

    jmeter -Djava.rmi.server.hostname=10.10.10.10 .....
    
  3. 在 jvisualvm -> Remote -> Add Remote Host 中放置一个连接字符串,如:

    • remote_machine_IP:remote_machine_PORT
    • service:jmx:rmi:///jndi/rmi://remote_machine_IP:remote_machine_PORT/jmxrmi

或者,您可以使用 PerfMon plugin which collects a way more detailed statistics and able to plot it via the relevant JMeter Listener. See How to Monitor Your Server Health & Performance During a JMeter Load Test 指南了解有关设置和使用 PerfMon 与 JMeter 的更多详细信息。