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. 【WPF】日常笔记(持续更新)

    本文专用于记录WPF开发中的小细节,作为备忘录使用. 1. 关于绑定: Text ="{Binding AnchorageValue,Mode=TwoWay,UpdateSourceTrig ...

  2. 【HDU4652】Dice(数学期望,动态规划)

    [HDU4652]Dice(数学期望,动态规划) 题面 Vjudge 有一个\(m\)面骰子 询问,连续出现\(n\)个相同的时候停止的期望 连续出现\(n\)个不同的时候停止的期望 题解 考虑两种分 ...

  3. POJ P1185 炮兵阵地 【状压dp】

    炮兵阵地 Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 29502 Accepted: 11424 Description 司令 ...

  4. 常用Actoin算子 与 内存管理 、共享变量、内存机制

    一.常用Actoin算子 (reduce .collect .count .take .saveAsTextFile . countByKey .foreach ) collect:从集群中将所有的计 ...

  5. 【loj2461】【2018集训队互测Day 1】完美的队列

    #2461. 「2018 集训队互测 Day 1」完美的队列 传送门: https://loj.ac/problem/2461 题解: 直接做可能一次操作加入队列同时会弹出很多数字,无法维护:一个操作 ...

  6. NYOJ--7

    原题链接:http://acm.nyist.net/JudgeOnline/problem.php?pid=7 分析:x与y分开考虑,分别排序,邮局定在最中间的两个数之间就可以了. 街区最短路径问题 ...

  7. 手脱nSPack 3.7

    方法一: 1.   OD查壳—nSpack3.7的壳 2. 载入OD 看起来很眼熟,F8一次,然后下面就可以使用ESP定律了,使用ESP定律下断点,然后F9四次 3.   F9四次后落到这个位置 接下 ...

  8. RabbitMQ的基础介绍

    转自:http://blog.csdn.net/whycold/article/details/41119807 一.引言 你是否遇到过两个(多个)系统间需要通过定时任务来同步某些数据?你是否在为异构 ...

  9. Java中关于Arrays.asList方法的深入学习与理解

    Java的标准库中在java.util包下提供了很多实用的工具类,如:Arrays,Collections等工具类都提供了一些比较实用的方法.在实际的开发使用中,我们经常需要使用这样的需求:将一个数组 ...

  10. 转:Unable to execute dex: Multiple dex files define 解决方法

    转自:http://blog.csdn.net/mxlxiao7/article/details/8978930 问题发生概述: 程序编译正常,在用Eclipse调试执行时,报错Unable to e ...