jmeter common errors and solutions

jmeter common errors:

 
  • 错误一:
    Response code: Non HTTP response code: java.net.SocketTimeoutException
    Response message: Non HTTP response message: connect timed out

Load time viewing time is greater than connect time out to set the time of request, so throw the exception. There may be due to more service end request is being processed (and the processing time is longer), leads not connected to the server JMeter generated.

  • 错误二:
    Java.NET.BindException: Address already in use: connect

The reason: a lot in a short time new socket operations, while socket.close () operation does not immediately release the port binding, but the port is set to TIMEWAIT state, over a period of time (default 240s) was released (with netstat -na We can see), and finally exhaustion of system resources (on windows is exhausted the pool of ephemeral ports, this interval between 1024-5000)
Workaround: on the run JMeter agent machine, add the registry entry HKEY_LOCAL_MACHINE \ sYSTEM \ CurrentControlSet \ Services \ Tcpip \ the Parameters
the MaxUserPort 65334
the TcpTimedWaitDelay 30

  • Error three:
    java.lang.OutOfMemoryError: the Java heap Space

The reason: observe the operation jmeter machine's memory, taking up higher, exceeding the upper limit jmeter memory settings.
Solution: Modify jmeter configuration file, adjust the range of available memory

Modify /bin/jmeter.bat file: find the 2 line
the SET HEAP = -Xms256m-Xmx256m-
the SET NEW = -XX: NewSize = 128M -XX: MaxNewSize = 128M
changed:
the SET HEAP = -Xms1024m -Xmx2048m (can not exceed the maximum system memory 1/2)
SET NEW = -XX: 128M the NewSize = -XX: MaxNewSize = 512M

  • 错误四:
    Response code: Non HTTP response code: java.net.SocketTimeoutException
    Response message: Non HTTP response message: Read timed out

When this error occurs, jmeter already connected to the server, view the load time does not exceed the set request timeout time, error possible cause is that the server side of the thread of outstanding requests, or to ensure service capacity, cut off the connection.
To validate this conjecture, for greater than half an hour the number of concurrent requests sent to the server after a period of time, request response 503 is received, proof conjecture.

  • 错误五:
    Failed to initialise remote engine java.rmi.ConnectException: Connection refused to host:

Reason: distributed testing, the connection between the server and the agent in question. After a single machine investigation found that the machine is an agent installed multiple network cards, find the rmi remote when the card is a virtual machine, the connection fails.
Solution: ban virtual machine network card is not used, then resume after the test.

jmeter running the script, the server performance parameters did not change significantly ( the CPU , memory, the I / O ), but the request response time is very long.

Reason: Observation jmeter agent machine network usage, network using a sustained peak bandwidth limit is reached. Process pending request sent in the network, and does not request concurrent real time to reach the same server, the server did not change significantly.
Solution: To improve the jmeter agent machine network bandwidth.

  • Error Six:

Connection timed out: connect

 java.net.ConnectException: Connection timed out: connect

         at java.net.DualStackPlainSocketImpl.connect0(Native Method)

         at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source)

         at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source)

         at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source)

         at java.net.AbstractPlainSocketImpl.connect(Unknown Source)

         at java.net.PlainSocketImpl.connect(Unknown Source)

         at java.net.SocksSocketImpl.connect(Unknown Source)

         at java.net.Socket.connect(Unknown Source)

         at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:121)

         at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:180)

         at org.apache.jmeter.protocol.http.sampler.hc.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:318)

         at org.apache.jmeter.protocol.http.sampler.MeasuringConnectionManager$MeasuredConnection.open(MeasuringConnectionManager.java:114)

         at org.apache.http.impl.client.DefaultRequestDirector.tryConnect(DefaultRequestDirector.java:610)

         at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:445)

         at org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:835)

         at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:83)

         at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.executeRequest(HTTPHC4Impl.java:654)

         at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:413)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.followRedirects(HTTPSamplerBase.java:1542)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.resultProcessing(HTTPSamplerBase.java:1636)

         at org.apache.jmeter.protocol.http.sampler.HTTPAbstractImpl.resultProcessing(HTTPAbstractImpl.java:519)

         at org.apache.jmeter.protocol.http.sampler.HTTPHC4Impl.sample(HTTPHC4Impl.java:493)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy.sample(HTTPSamplerProxy.java:74)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1189)

         at org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1178)

         at org.apache.jmeter.threads.JMeterThread.executeSamplePackage(JMeterThread.java:491)

         at org.apache.jmeter.threads.JMeterThread.processSampler(JMeterThread.java:425)

         at org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:254)

         at java.lang.Thread.run(Unknown Source)

原因分析

可能是因为端口号耗尽,一般一台服务器的端口号最多是65535个,建议使用该命令分别查看下压测机与服务器的端口使用情况,netstat -nat|grep -i 8080|wc -l,如果这个个数在6w左右,那可能就是端口号用尽,同时查看下大多数的端口状态,应该都是time_wait状态
解决方案:
如果是压测机,端口号用尽,那就增加压测机,使用jmeter分布式压测(jmeter默认开启keep_alive的)
如果数服务器,端口号用尽,最大的可能是服务器端开了短链接,把短链接配置变成长连接即可
因为如果服务器端是短链接,当jmeter每发起一个请求就会建立一次tcp三次握手,传输完数据后,连接其实没有关,连接状态是time_wait,下个请求来了,会重新开启一个新的端口,建立tcp三次握手,传输数据....,这样随着请求的越来越多,端口就会变得越来越少,所以端口很快耗尽,而且大多数端口都处于time_wait状态,如果服务器端也支持长连接,那么下次请求来了,就会在上次请求的通道上继续传输,端口使用率大大的降低,就有效的避免了端口耗尽问题。

 

原因:Jmeter默认禁掉了运行过程中每个request的具体response信息收集,只保留了status。
解决方法:修改jmeter.properties文件中Results file configuration。把所有和response相关False的项改为True。运行后将输出保存.jtl文件中。添加tree监听器,过滤只显示error request,可以查看到request和response的具体信息,从而判断出错原因。

tree report中显示socket time out相关的错误,如何判断是jmeter工具的原因,还是服务器的原因。

Guess you like

Origin www.cnblogs.com/jane4321/p/11013042.html