1. 程式人生 > >linux和windows下TIME_WAIT過多的解決辦法

linux和windows下TIME_WAIT過多的解決辦法

iss abs apach cti ack tps als improve increase

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。。。
是不對的

Apache multiple requests with jmeter

Ask Question
up vote0down votefavorite 1

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.

java apache jmeter jboss5.x
shareimprove this question edited Jan 8 ‘13 at 11:46 技術分享 Aliaksandr Belik 9,21054374 asked Jan 7 ‘13 at 11:15 技術分享 PyiSoeMaw 2016
add a comment

1 Answer

activeoldestvotes
up vote7down voteaccepted

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.

shareimprove this answer edited Jan 9 ‘13 at 15:30 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過多的解決辦法