Jmeter的两个问题:Java Sampler打印日志与Windows下报Address Already in use:connect

来源:互联网 发布:大数据顶尖企业 编辑:程序博客网 时间:2024/06/05 16:49

第一个问题: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/

  1. Start Registry Editor.
  2. Locate the following subkey in the registry, and then click ParametersHKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
  3. On the Edit menu, click New, and then add the following registry entry:
Value Name: MaxUserPortValue Type: DWORDValue data: 65534Valid 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.confnet.ipv4.ip_local_port_range = 1024 65000net.ipv4.ip_conntrack_max = 10240


进行修改,sysctl是可以用来改变改变Linux内核参数的命令。


第二个问题:打印Jmeter错误日志

Jmeter的JavaSampler打印日志
getLogger.error(message);

会打印到错误日志中,以解决非GUI方式运行出错时看不到错误原因的情况。



原创粉丝点击