Server Fault is a question and answer site for system and network administrators. 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'm running comet server on linux (Debian).
All the connections are proxied by nginx.
And my time_wait/established rate is too big (50k/15k) although I set reuse_connections.
I'd like to reduce this huge amount of unneeded connections in time_wait state.
Here is my sysctl.conf rules:

net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_keepalive_time = 60
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_max_tw_buckets = 360000

Could you give me some clue on how to reduce time_waits?

share|improve this question
What is your problem? What do you want to achieve? – cstamas Mar 2 '12 at 8:44
I want to reduce the amount of unneded connections (in time_wait state) – tsds Mar 2 '12 at 9:15

net.ipv4.tcp_max_tw_buckets = 360000

Why is having 50K sockets in TIME_WAIT an issue when you allow for 360K of them ?

share|improve this answer
is it ok to set tcp_max_tw_buckets to lower value? if I do so would linux start to reuse my timewaits effectively? – tsds Mar 2 '12 at 9:31
I saw somewhere a suggestion about tcp_max_tw_buckets "you should possibly need to increase this value if you start receiving errors due to this setting" which means that it is not the correct way to lower the number of TIME_WAITs – tsds Mar 2 '12 at 9:36
....WHY do you think you NEED to LOWER them? – adaptr Mar 2 '12 at 9:40
because these connections uses my server resources although they are actually doing nothing – tsds Mar 2 '12 at 9:51
What kind of empirical evidence do you have of this ? Why then is the allowed number of time_wait buckets up to 360K, and if you did not set this value, doesn't it follow that this will be a reasonable default that you have no reason to change ? – adaptr Mar 2 '12 at 10: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.