4

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】

 1 year ago
source link: https://blog.51cto.com/u_15874356/5918764
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】

精选 原创

HI王小呆 2022-12-07 12:23:16 ©著作权

文章标签 连接数 TCP java 文章分类 IT职场 其它 阅读数209

一、现象描述

在windows环境下,使用jmeter进行性能测试时,在并发量较大的情况下,发现有大量的接口报错
报错内容为:java.net.BindException: Address already in use: connect

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】_连接数

经查询资料得知,windows提供给TCP/IP链接的端口为 1024-5000,并且要四分钟来循环回收它们,就导致我们在短时间内跑大量的请求时将端口占满了,导致如上报错。
同时对比TPS报错及监控平台连接数,佐证了这一点。

TPS图表,红色框框内为基本全部报错。

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】_TCP_02

同一时间监控平台监控到的连接数情况

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】_java_03

对照可以看出,当连接数超过5000左右的时候,开始大量报错。在连接数释放的过程中,又会有请求成功,当再次达到5000的时候,后续的连接又几乎全部失败。

三、解决办法

1.cmd中输入regedit命令打开注册表;
2.在HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters右键Parameters;
3.添加一个新的DWORD,名字为MaxUserPort;
4.然后双击MaxUserPort,输入数值数据为65534,基数选择十进制;
5.完成以上操作,重新进行测试,就可以解决问题

四、重新测试

TCP没有再报错

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】_java_04

连接数达到了8K+

【JMETER压力测试报错:java.net.BindException: Address already in use: connect】_连接数_05
  • 收藏
  • 评论
  • 分享
  • 举报

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK