http://www.51testing.com/html/48/202848-249774.html

linux和windows下TIME_WAIT过多的解决办法

http://m.sohu.com/a/122714498_412810

Windows time_wait过多解决办法

沐浴晨曦:
是配置的问题。。
除了用tcpwaitdelay之外 还需要配置maxuserport 除此之外 还需要加入动态端口的范围 netsh int ipv4 set dynamicport tcp start=1025 num=60000
沐浴晨曦:
tcpwaitdelay的值必须为微软官方推荐值 30 dword值是1e
我试过改成1 或者5 问题复现
沐浴晨曦:
改为30 问题消失 猜测如果值不是30到300就使用默认值240
沐浴晨曦:
也就是四分钟回收tcp链接

百度来的答案 改成什么 1或者0。。。
是不对的

I am using Jmeter to test multiple requests to my web application.
I used NumberOfThread in Jmeter as 50.

My process is as follows:

  1. Login page.
  2. Login with userID and password.
  3. Show menu page.
  4. Click search page.
  5. Go to search page.
  6. Click search button.
  7. Click the searched result link to go to update page.
  8. Update data and click update button.
  9. Show the updated result page.
  10. Go back to search page.
  11. Log out button click.

In the above process, I used looping controller for process number 5 to 10 with 5 looping.
In that situation, if I used more than 25 thread to run Jmeter test, address already in use, the socket binding exception has occur.

I would like to know how to solve that problem.

asked Jan 7 '13 at 11:15
PyiSoeMaw

2016
 

Looks like your client ran out of ephemeral port or there's some problem with your client environment.
Are you using Windows?

You can possibly do at least the following:

  1. Windows: look into this article for solution for Windows system as host for jmeter.
  2. Use Linux system instead as host to run you Jmeter load-scenarios.

As well you possibly will find this article useful for your testing activities (I've seen Jboss in tags).


UPDATE:

Once more from linked article above:

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.

echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle

Other options include TCP_FIN_TIMEOUT to reduce how long a connection is placed in the TIME_WAIT state and TCP_TW_REUSE to allow the system to reuse connections placed in the TIME_WAIT state.

On the server's side:

  • This enables fast recycling of TIME_WAIT sockets

    /sbin/sysctl -w net.ipv4.tcp_tw_recycle=1

  • This allows reusing sockets in TIME_WAIT state for new connections - a safer alternative to tcp_tw_recycle

    /sbin/sysctl -w net.ipv4.tcp_tw_reuse=1

    The tcp_tw_reuse setting is particularly useful in environments where numerous short connections are open and left in TIME_WAIT state, such as web-servers. Reusing the sockets can be very effective in reducing server load.

  • Maximum number of timewait sockets held by system simultaneously

    /sbin/sysctl -w net.ipv4.tcp_max_tw_buckets=30000

or the same but in another way - add the lines below to the /etc/sysctl.conf file so that the change survives reboot:

net.ipv4.tcp_max_tw_buckets = 30000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1

As well on the server's side look onto result of ulimit -n.
Default value is 1024 for the limit of max open files, which can explain appearance of BindExceptions at 1000 connections.

As well you can monitor number of connections between the server and jmeter during test-run using e.g.

netstat -an | grep SERVER_PORT | wc -l

to define limit of connections - if any.

answered Jan 7 '13 at 16:51
Aliaksandr Belik

9,21054374
 
    
Thanks Belik, your answer very helpful for me. However, it still not solved by trying them. – PyiSoeMaw Jan 8 '13 at 11:44
    
So, any new details? If Windows OS: same behavior after applying all the instructions? – Aliaksandr Belik Jan 8 '13 at 12:39
    
I am using CentOS 5 for Apache Server and testing from Windows XP client PC. I have followed the detail procedure of the referenced link. However, it didn't work. But I found something that if I changed KeepAliveTimeout into 15 in httpd.conf file in CentOS server, it does solved the problem. Honestly, I don't clearly understand why it is solved by doing it. Do you have any idea about it? – PyiSoeMaw Jan 9 '13 at 3:37
    
Have you increased or decreased KeepAliveTimeout value? Please look into update in answer, I've added several common issues for load-testing using linux boxes. Maybe something of these point will be helpful for you. – Aliaksandr Belik Jan 9 '13 at 13:03

linux和windows下TIME_WAIT过多的解决办法的更多相关文章

  1. Windows下NetBeans中文乱码解决办法

    找到你的Netbeans安装目录下的etc文件夹,用记事本打开netbeans.conf,找到netbeans_default_options(不是最后那个带句号的…), 在其属性的最后(冒号以内)加 ...

  2. linux 下Time_wait过多问题解决

    linux 下Time_wait过多问题解决 net.ipv4.tcp_syncookies = 1表示开启SYN Cookies.当出现SYN等待队列溢出时,启用cookies来处理,可防范少量SY ...

  3. 【转】linux和windows下安装python集成开发环境及其python包

    本系列分为两篇: 1.[转]windows和linux中搭建python集成开发环境IDE 2.[转]linux和windows下安装python集成开发环境及其python包 3.windows和l ...

  4. Hyper-V下的Linux虚拟机网卡丢失问题原因及解决办法

    Hyper-V下的Linux虚拟机网卡丢失问题原因及解决办法   虚拟化大势所趋 公司推行了虚拟化,全部用的是Microsoft Windows 2008 R2 Enterprise with Hyp ...

  5. 从Docker在Linux和Windows下的区别简单理解Docker的层次结构

    上篇文章我们成功在Windows下安装了Docker,输出了一个简单的Hello World程序.本文中我们将利用Docker已有的云端镜像training/webapp来发布一个简单Python的W ...

  6. 【深度学习】在linux和windows下anaconda+pycharm+tensorflow+cuda的配置

    在linux和windows下anaconda+pycharm+tensorflow+cuda的配置 在linux和windows下anaconda+pycharm+tensorflow+cuda的配 ...

  7. [笔记]linux下和windows下的 创建线程函数

    linux下和windows下的 创建线程函数 #ifdef __GNUC__ //Linux #include <pthread.h> #define CreateThreadEx(ti ...

  8. protobuff 配合 libevent 在Linux 和windows 下的使用

    protobuff 配合 libevent 在Linux 和windows 下的使用待补全. libprotobuf.lib libproto-lite.lib libprotoc.lib

  9. tar.xz如何解压:linux和windows下tar.xz解压命令介绍

    在linux下怎么解压和压缩tar.xz文件? (本文由www.169it.com搜集整理) 在linux下解压tar.xz文件步骤 1 2 # xz -d ***.tar.xz  //先解压xz # ...

随机推荐

  1. 【Python3的进制扫盲】

    一.进制 1.进制简介 进制就是进位制,是人们规定的一种进位方法.计算机底层的数据运算和存储都是二进制数据.计算机语言就是二进制,计算机能直接识别二进制数据,其它数据都不能直接识别. 2.常用进制 对 ...

  2. 扶苏的bitset浅谈

    bitset作为C++一个非常好用的STL,在一些题目中巧妙地使用会产生非常不错的效果.今天扶苏来分享一点bitset的基础语法和应用 本文同步发布于个人其他博客,同时作为P3674题解发布. 本文感 ...

  3. 【DP】【CF9D】 How many trees?

    传送门 Description 给你两个正整数\(n,h\),求由\(n\)个点组成的高度大于等于\(h\)的二叉树有多少个 Input 一行两个整数\(n,h\) Output 一个整数代表答案. ...

  4. web项目引用tomcat中的jar

    web项目引用tomcat中的jar https://blog.csdn.net/zjsdrs/article/details/77868827 如下图所示

  5. 「Linux」VMware安装centos7(二)

    一.检查是否联网 命令:ping www.baidu.com 二.查询系统中的地址信息 命令:ip addr 三.查看当前网络连接 命令:nmcli connection show 四.设置网络连接 ...

  6. [LeetCode] 31. Next Permutation ☆☆☆

    Implement next permutation, which rearranges numbers into the lexicographically next greater permuta ...

  7. [洛谷P4609] [FJOI2016]建筑师

    洛谷题目链接:[FJOI2016]建筑师 题目描述 小 Z 是一个很有名的建筑师,有一天他接到了一个很奇怪的任务:在数轴上建 \(n\) 个建筑,每个建筑的高度是 \(1\) 到 \(n\) 之间的一 ...

  8. C++ Arithmetic Exception

    运算异常错误,比如除零错误,浮点数取余等等.

  9. easyui 控件获取焦点方式

    针对easyui控件前端组织的dom做分析,如下: combo/combobox/combogrid类似结构如下: <input class="easyui-datebox dateb ...

  10. 《JavaScript 实战》:实现图片幻滑动展示效果

    滑动展示效果主要用在图片或信息的滑动展示,也可以设置一下做成简单的口风琴(Accordion)效果.这个其实就是以前写的图片滑动展示效果的改进版,那是我第一篇比较受关注的文章,是时候整理一下了. 有如 ...