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. Spring中使用要点集合

    1.InitializingBean和init-method方法 Spring的InitializingBean为bean提供了定义初始化方法的方式.InitializingBean是一个接口,它仅仅 ...

  2. ZJOI 2017 二试 day1 4.26

    day0,11:30熄灯,又因为在房间里太浪,空调开了28度,过了好久才成功降温,导致睡得不太好QaQ. 于是早上昏昏欲睡,也没怎么听懂(orz孙耀峰). 中午大家一致提议下午不去听课,回到房间浪了好 ...

  3. 解题:POI 2018 Prawnicy

    题面 网上好像都是堆的做法啊......我这个不算离散化是$O(n)$的说(虽然有一坨vector可能不开O2会爆炸) 题目即是让我们求是否存在一个最长的是不少于$k$个给出区间子集的区间,如果存在输 ...

  4. 【bzoj2893】征服王

    Portal -->bzoj2893 Descripiton 给你一个\(n\)个点\(m\)条边的有向图,有一些点是起始点,有一些点是终止点,一次操作可以从一个起始点开始沿着有向图的边走到一个 ...

  5. STL源码分析-deque

    http://note.youdao.com/noteshare?id=66f21dca07c1984f41848700021644fd

  6. python析构函数

      class Test(object): def __init__(self, name): self.name = name print('这是构造函数') def say_hi(self): p ...

  7. Jenkins使用教程之管理节点

    通常的情况下在我们的一个项目当中,项目会有多个分支系统,而我们不可能为每个分支系统都配置一个jenkins服务,这样既浪费资源,也增加构建部署的难度,为了解决这个问题jenkins给使用者提供了非常强 ...

  8. Win10环境下配置VScode的C++编译环境

    写前感想:前前后后,折腾好几次,最后还是在学长安利下,开始入坑vscode了.原因一个是小巧,还有就是vs新建工程码题的方式太消耗内存了,基本每个项目就是以MB为单位计算的,然后希望用这篇文章记录自己 ...

  9. HDU 4946 凸包

    给你n个点,具有速度,一个位置如果有其他点能够先到,则不能继续访问,求出里面这些点哪些点是能够无限移动的. 首先我们考虑到,一个速度小的和一个速度大的,速度小的必定只有固定他周围的一定区域是它先到的, ...

  10. C11线程管理:条件变量

    1.简介 C11提供另外一种用于等待的同步机制,它可以阻塞一个或者多个线程,直到收到另外一个线程发出的通知或者超时,才会唤醒当前阻塞的线程.条件变量要和互斥量配合起来使用. condition_var ...