There are a lot of Fin_Wait2, Close_Wait, Last_Ack and Time_Wait in Haproxy

We are running haproxy for about 100,000 concurrent users. But we see a lot of FIN_WAIT2, CLOSE_WAIT, LAST_ACK and TIME_WAIT in the netstat output. This output is on the 8G ubuntu-12.04 node.

8046 CLOSE_WAIT 
1 CLOSING
1 established)
40869 ESTABLISHED
1212 FIN_WAIT1
7575 FIN_WAIT2
1 Foreign
2252 LAST_ACK
7 LISTEN
143 SYN_RECV
4920 TIME_WAIT

Can someone tell me what adjustments I need to make?
Please note that all these connections are persistent.

tcp_fin_timeout = 30 
tcp_keepalive_time = 1800

Now, the application It works fine. However, when we add more users to this haproxy node, we want to know if there will be any problems.

The connection you listed in the first paragraph is ESTABLISHED or is being cleaned up after use. Established means the meaning of the name. A connection is established between one of your users and HAProxy. Use as expected.

The other states you mentioned in the first paragraph all indicate that the previously established connection has completed the transmission of data. The best way I can explain with the diagram.

In short It: If you have a lot of FIN_WAIT 1 and FIN_WAIT 2, then the server has no problem. You are just waiting for the client to complete.

Since it is not a problem with the server, add more users before reaching the kernel network limit It shouldn’t be a problem. You didn’t post what those are, so I can’t comment on how close you are to them.

We are running haproxy for about 100,000 concurrent users. But We see a lot of FIN_WAIT2, CLOSE_WAIT, LAST_ACK and TIME_WAIT in the netstat output. This output is located on the 8G ubuntu-12.04 node.

8046 CLOSE_WAIT 
1 CLOSING
1 established)
40869 ESTABLISHED
1212 FIN_WAIT1
7575 FIN_WAIT2
1 Foreign
2252 LAST_ACK
7 LISTEN
143 SYN_RECV
4920 TIME_WAIT

Can someone tell me what adjustments I need to make?
Please note that all these connections are persistent.

tcp_fin_timeout = 30 
tcp_keepalive_time = 1800

Now, the application It works fine. However, when we add more users to this haproxy node, we want to know if there will be any problems.

You listed in the first paragraph The outgoing connection is ESTABLISHED or is being cleaned up after use. Established means the meaning of the name. A connection is established between one of your users and HAProxy. Use as expected.

You are first The other states mentioned in the paragraph all indicate that the previously established connection has finished transmitting data. I can explain the best way with the diagram.

In short: if you have a lot of FIN_WAIT 1 and FIN_WAIT 2, Then there is nothing wrong with the server. You are just waiting for the client to complete.

Since it’s not a problem with the server, adding more users before reaching the kernel network limit shouldn’t be a problem. You haven’t posted what those are, so I cannot comment on how close you are to them.

Leave a Comment

Your email address will not be published.