问答 jmeter 分布式压测,为何聚合报告里的样本总数少于并发数,具体如下

暖暖暖暖冬😀😍 · 2021年09月24日 · 最后由 陈恒捷 回复于 2021年10月08日 · 4136 次阅读

压力机 9 台,控制机 1 台,其中同步定时器设置的 700 并发,相当于 700*9 的总并发数,但是远程启动所有压力机完成后,样本数却少于并发数,求教是哪些问题引起的。

021-09-24 14:57:01,843 ERROR o.a.j.t.JMeterThread: Test failed!
org.apache.jorphan.util.JMeterError: Could not return sample
    at org.apache.jmeter.samplers.StandardSampleSender.sampleOccurred(StandardSampleSender.java:69) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.samplers.RemoteListenerWrapper.sampleOccurred(RemoteListenerWrapper.java:94) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.ListenerNotifier.notifyListeners(ListenerNotifier.java:58) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.notifyListeners(JMeterThread.java:1024) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:579) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:489) ~[ApacheJMeter_core.jar:5.4.1]
    at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256) [ApacheJMeter_core.jar:5.4.1]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_202]
Caused by: java.rmi.ConnectException: Connection refused to host: 115.227.33.18; nested exception is: 
    java.net.ConnectException: Connection timed out: connect
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.server.UnicastRef.invoke(Unknown Source) ~[?:1.8.0_202]
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) ~[?:1.8.0_202]
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) ~[?:1.8.0_202]
    at com.sun.proxy.$Proxy20.sampleOccurred(Unknown Source) ~[?:?]
    at org.apache.jmeter.samplers.StandardSampleSender.sampleOccurred(StandardSampleSender.java:66) ~[ApacheJMeter_core.jar:5.4.1]
    ... 7 more
Caused by: java.net.ConnectException: Connection timed out: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[?:1.8.0_202]
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[?:1.8.0_202]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[?:1.8.0_202]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[?:1.8.0_202]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_202]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[?:1.8.0_202]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[?:1.8.0_202]
    at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_202]
    at java.net.Socket.connect(Unknown Source) ~[?:1.8.0_202]
    at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_202]
    at java.net.Socket.<init>(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.tcp.TCPEndpoint.newSocket(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) ~[?:1.8.0_202]
    at sun.rmi.server.UnicastRef.invoke(Unknown Source) ~[?:1.8.0_202]
    at java.rmi.server.RemoteObjectInvocationHandler.invokeRemoteMethod(Unknown Source) ~[?:1.8.0_202]
    at java.rmi.server.RemoteObjectInvocationHandler.invoke(Unknown Source) ~[?:1.8.0_202]
    at com.sun.proxy.$Proxy20.sampleOccurred(Unknown Source) ~[?:?]
    at org.apache.jmeter.samplers.StandardSampleSender.sampleOccurred(StandardSampleSender.java:66) ~[ApacheJMeter_core.jar:5.4.1]
    ... 7 more
共收到 4 条回复 时间 点赞

Connection refused to host: 115.227.33.18 网络不通啊

重来看雨 回复

通的,但是数量上去之后跑玩的部分数据回传不回控制机:Could not return sample

看下 master 的资源情况,是否 CPU、负载 或者带宽满了。

但是远程启动所有压力机完成后,样本数却少于并发数

样本数具体是多少,少了多少?你这里信息不完整。

另外,同步计时器原理上是通过阻塞进程来一次性发出压力的,只能阻塞单个 jvm 里面的线程。你这里用了多个压力机,jmeter 自带的 master/slave 通讯机制,是无法保障跨压力机情况下的同步计时器线程累计数的。

比如你脚本里同步计时器设置了 200,那实际上是每个 slave 自己分别去累积 200 个并发一起发,而不是全部 slave 一起累积 200*9 个并发一起发。具体可以参考下

https://zhuanlan.zhihu.com/p/72945182
https://stackoverflow.com/questions/54228259/how-to-synchronize-request-send-time-across-different-nodes-in-jmeter

需要 登录 后方可回复, 如果你还没有账号请点击这里 注册