Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I did some load test under Ubuntu10.10 with Siege 2.6.9, script I used as follows,
siege -c 900 -r 30 -i -f urls.txt, but I got tons of error messages like

error: socket: unable to connect sock.c:222: Operation already in progress or socket timeout

I noticed most requests' response time are less than 0.2 secs, but after a while, some requests' response time increased to 5 secs, and a pause happened periodically,
So I did some linux kernel tuning jobs, e.g.

sysctl -w net.ipv4.tcp_tw_reuse=1  
sysctl -w net.ipv4.tcp_timestamps=1  
sysctl -w net.ipv4.tcp_tw_recycle=1  

After that, the circumstance became better, but not good enough,
So could you guys could give me more infomation about socket/tcp parameters tuning on
linux kernel parameters, such as recycle/reuse/close the sockets in a TIME_WAIT state.
Any advices or suggestions would be highly appreciated. Many thanks.

share|improve this question
up vote 3 down vote accepted

You might want to try lowering net.ipv4.tcp_fin_timeout, which affects how long the sockets hang out in TIME_WAIT. This is already fairly low at 60; try lowering it 10 at a time and see if it improves the situation.

 echo 50 >/proc/sys/net/ipv4/tcp_fin_timeout 

If it works, add it to sysctl.conf:

net.ipv4.tcp_fin_timeout = 50 # or whatever works best

Just keep in mind that, while it helps with load testing, it isn't necessarily a great default for real-world usage.

  • Eric
share|improve this answer
@Eric Maybe the problem has nothing to do with socket, it's a matter of load testing tool, I'll do the test again with another tool(e.g. Jmeter or something). Thanks anyway. – LeoYuan 袁力皓 Jun 2 '11 at 3:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.