FastNetMon

Sunday 5 December 2010

Что такое TIME_WAIT статус tcp сокета в Linux?

http://www.softlab.ntua.gr/facilities/documentation/unix/unix-socket-faq/unix-socket-faq-2.html#ss2.7

В двух словах:
When you close a socket, the server goes into a TIME_WAIT state, just to be really really sure that all the data has gone through

А вот пару слов, почему они могут быть вредны, эти самые TIME_WAIT соединения: http://wiki.apache.org/HttpComponents/FrequentlyAskedConnectionManagementQuestions

Есть пара вариантов, как избежать пагубного влияния большого числа TIME_WAIT на обработку соединений, они включаются ключами sysctl:
tcp_tw_recycle - BOOLEAN
Enable fast recycling TIME-WAIT sockets. Default value is 0. It should not be changed without advice/request of technical experts.

tcp_tw_reuse - BOOLEAN
Allow to reuse TIME-WAIT sockets for new connections when it is safe from protocol viewpoint. Default value is 0. It should not be changed without advice/request of technical experts.

Источник: документация ядра Линукс, Documentation/networking/ip-sysctl.txt

1 comment :

  1. Если вдруг нужно прибить такое соединение, то это можно сделать с помощью утилиты killcx и отладчика gdb.

    ReplyDelete

Note: only a member of this blog may post a comment.