user138821
user138821

Reputation: 444

Why is tcp_tw_reuse turned off by default?

I had an issue where I was running out of connections due to all of them being in a TIME_WAIT state. Setting the timeout to 1s still caused the issue. We use a load balancer so I went with tcp_tw_reuse instead of recycle. I am going to release code that requires the use of tcp_tw_reuse being turned on.

However, I assume there is some potential for negative impact with tcp_tw_reuse, but I can't think of what it might be. Does anyone know why this isn't turned on by default in Linux installations?

Or, can anyone list any potential negative impacts? I assume this doesn't have any impact on the system until it runs out of connections, at which point the need for this seems obvious.

Thanks.

Upvotes: 2

Views: 3895

Answers (2)

user138821
user138821

Reputation: 444

Saw a great article on this today, that provides a really in depth answer that I thought anyone that ran across this question should have:

http://vincent.bernat.im/en/blog/2014-tcp-time-wait-state-linux.html

After reviewing it, it looks like the change I made to use tcp_tw_reuse doesn't even impact incoming connections, so it appears that my original solution was a fruitless change on my part.

Upvotes: 2

user207421
user207421

Reputation: 311013

The TIME_WAIT state is an integral part of TCP. It is a security/data integrity measure to prevent data from two sequential connections between the same port numbers from getting mixed up. You should certainly not mess around with it. The only problem it can cause is a bind error when creating outbound connections. It is ultimately caused by applications that should be using connection pooling and aren't.

Upvotes: 1

Related Questions