本文介绍了JMeter-在Windows 7中负载测试超过120个线程时的连接重置和SSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从Windows 7/10加载具有最新JMeter 3.3的测试网站

I'm trying to load test website with latest JMeter 3.3 from windows 7/10

当线程数为120或以上时,我开始从F5获得SSL握手失败.

When threads are 120 or above I start getting SSL handshakes failures from F5.

在执行中添加-Djavax.net.debug=all时,我发现许多不同的套接字异常为:

When I add -Djavax.net.debug=all to execution I found many different socket exceptions as:

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(Unknown Source)
at sun.security.ssl.SSLSocketImpl.startHandshake(Unknown Source)

java.net.SocketException: Connection reset
at java.net.SocketInputStream.read(Unknown Source)
at java.net.SocketInputStream.read(Unknown Source)
at sun.security.ssl.InputRecord.readFully(Unknown Source)
at sun.security.ssl.InputRecord.read(Unknown Source)
at sun.security.ssl.SSLSocketImpl.readRecord(Unknown Source)

 java.net.SocketException: Connection reset by peer: socket write error
at java.net.SocketOutputStream.socketWrite0(Native Method)
at java.net.SocketOutputStream.socketWrite(Unknown Source)
at java.net.SocketOutputStream.write(Unknown Source)
at sun.security.ssl.OutputRecord.writeBuffer(Unknown Source)
at sun.security.ssl.OutputRecord.write(Unknown Source)

我遵循 answer ,但可能已过时:

I follow answer, but it may be outdated:

httpclient4.retrycount = 1 hc.parameters.file = hc.parameters在 hc.parameters文件(相同位置-JMeter的/bin文件夹)取消注释 下一行:

httpclient4.retrycount=1 hc.parameters.file=hc.parameters In the hc.parameters file (same location - JMeter's /bin folder) uncomment the next line:

http.connection.stalecheck $ Boolean = true

http.connection.stalecheck$Boolean=true

如何防止这些错误?我尝试调整加速周期,但没有帮助.我还尝试添加建议在此处的EnableConnectionRateLimiting注册表.失败了.

How can prevent those errors? I tried adjusting ramp up period but it didn't helped.I also tried adding EnableConnectionRateLimiting registry suggested here and failed.

我是否在Windows上达到了JMeter的限制,或者可以对其进行配置/增加?

Did I reach the limit to JMeter on windows or can it be configured/increased?

编辑

我尝试使用不同的重试次数和Java实现来设置HTTP,但是没有更改.

I tried setting HTTP with different retry count and with Java implementation but no change.

EDIT2

我发现对我的HTTP请求使用特定的正确TLSv1.2协议可以解决此问题,在jmeter.properties中添加以下行:

I found that using specific proper TLSv1.2 protocol for my HTTP Request fixed the issue, in jmeter.properties add the line:

https.socket.protocols=TLSv1.2

增强使得http参数可配置.

There was enhancement for make http parameters configurable.

这使我能够在启动期间将负载最多增加到220个线程而没有SSL握手错误.

This enable me to increase load up to ~220 threads without SSL handshake errors in the ramp up period.

推荐答案

您可能需要调整Windows tcp设置,以避免达到打开的端口限制.

You may need to adjust windows tcp settings to avoid reaching opened port limits.

看到这个:

您需要设置:

  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\MaxUserPorthttp://technet.microsoft.com/en-us/library/aa995661.aspx
  • HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\TcpTimedWaitDelayhttp://technet.microsoft.com/en-us/library/bb397379.aspxWindows 2003Reduce the TIME_WAIT by setting the TcpTimedWaitDelay TCP/IP parameter to 30 seconds on the windows registry key

HKLM \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters,作为DWORD值.通过将Windows注册表项HKLM \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters上的MaxUserPort TCP/IP参数设置为更高的值(例如32768),以增加临时端口的范围,并将其作为DWORD值.这会将端口范围设置为1024到32768.

HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, as a DWORD value.Increase the range of ephemeral ports by setting the MaxUserPort TCP/IP parameter to an higher value (like 32768), on the windows registry key HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, as a DWORD value. This will set the port range from 1024 to 32768.

Windows 2008 R2通过将Windows注册表项HKLM \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters上的TcpTimedWaitDelay TCP/IP参数设置为30秒作为DWORD值来减少TIME_WAIT.通过命令netsh int ipv4 set dynamicportrange tcp start = 32767 num = 65535命令将dynamicportrange设置为更高的值,以增加临时端口的范围,这会将端口范围设置为32768至65535.

Windows 2008 R2Reduce the TIME_WAIT by setting the TcpTimedWaitDelay TCP/IP parameter to 30 seconds on the windows registry key HKLM\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters, as a DWORD value.Increase the range of ephemeral ports by setting the dynamicportrange to an higher value through the command netsh int ipv4 set dynamicportrange tcp start=32767 num=65535, this will set the port range from 32768 to 65535.

这篇关于JMeter-在Windows 7中负载测试超过120个线程时的连接重置和SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-31 13:20