第一个问题:Windows下用Jmeter的Address Already In Use问题
Jmeter在Windows下压力测试时,压了几千个请求后会出现访问不通的情况,报Address Already In Use,原因在于windows下的端口号有限制,只用那几千个,循环利用,如果一两分钟内请求建立太多就会用光,因此需要修改注册表来解决。Linux不会有此问题。参考:http://twit88.com/blog/2008/07/28/jmeter-exception-javanetbindexception-address-already-in-use-connect/
- Start Registry Editor.
- Locate the following subkey in the registry, and then click Parameters: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
- On the Edit menu, click New, and then add the following registry entry:
Value Name: MaxUserPort
Value Type: DWORD
Value data: 65534
Valid Range: 5000-65534 (decimal)
Default: 0x1388 (5000 decimal)
Description: This parameter controls the maximum port number that is used when a program requests any available user port from the system. Typically , ephemeral (short-lived) ports are allocated between the values of 1024 and 5000 inclusive.
Exit Registry Editor, and then restart the computer.Linux下,则通过sysctl -a|grep range来查看端口号范围,可以通过
vi /etc/sysctl.conf
net.ipv4.ip_local_port_range = 1024 65000
net.ipv4.ip_conntrack_max = 10240进行修改,sysctl是可以用来改变改变Linux内核参数的命令。
第二个问题:打印Jmeter错误日志
Jmeter的JavaSampler打印日志getLogger.error(message);会打印到错误日志中,以解决非GUI方式运行出错时看不到错误原因的情况。
本文详细介绍了在Windows环境下使用JMeter进行压力测试时遇到的AddressAlreadyInUse问题及其解决方案,包括通过修改注册表增加可用端口数量。同时,还解释了如何在非GUI方式运行JMeter时通过打印错误日志来定位问题。
767

被折叠的 条评论
为什么被折叠?



