JMeter报Non HTTP response message: Address already in use: connect错误问题

场景:用JMeter做压力测试的时候,一段时间后Aggregate Report报告里的错误率就一直上升,查看View Results Tree报告时发现报如下错误:

Response code:Non HTTP response code: java.net.BindException

Response message:Non HTTP response message: Address already in use: connect

这个是因为发送HTTP请求时需要为TCP/IP连接分配一个临时端口,客户端关闭连接后,连接会有60s时间处于等待状态。JMeter做压测时每秒发送数千个HTTP请求,系统会耗尽可供分配的临时端口造成临时端口不够用,可以在注册表里设置一下解决这个报错。

1. 问题原因描述:(网上找来的)

When an HTTP request is made, an ephemeral port is allocated for the TCP / IP connection. The ephemeral port range is 32678 – 61000. After the client closes the connection, the connection is placed in the TIME-WAIT state for 60 seconds.

If JMeter (HttpClient) is sending thousands of HTTP requests per second and creating new TCP / IP connections, the system will run out of available ephemeral ports for allocation.

Otherwise, the following messages may appear in the JMeter JTL files:

Non HTTP response code: java.net.BindException
Non HTTP response message: Address already in use

The solution is to enable fast recycling TIME_WAIT sockets.

2. 具体修改注册表如下:

进入注册表HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters,右键新建如下2项:

右键New->DWORD (32-bit) Value, 名称输入:TcpTimedWaitDelay,修改值为30(十进制),如下图所示。设置等待时间为30s。

 右键New->DWORD (32-bit) Value, 名称输入:MaxUserPort,修改值为65534(十进制),如下图所示。设置最大连接数为65534。

 设置完成后重启电脑。再使用JMeter测试之前的脚本就不会再报此错误。

  • 1
    点赞
  • 12
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值