closing tcp connections on linux under heavy load - TCP-IP

This is a discussion on closing tcp connections on linux under heavy load - TCP-IP ; Hi, I met a problem with with tcp connections on a linux 2.6.18 (both clients and servers). I have an echo service that can be represented by 1, 2, 3 or 4 processes that listen on the same ip/port. This ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: closing tcp connections on linux under heavy load

  1. closing tcp connections on linux under heavy load

    Hi,

    I met a problem with with tcp connections on a linux 2.6.18 (both
    clients and servers).

    I have an echo service that can be represented by 1, 2, 3 or 4
    processes that listen on the same ip/port. This service accepts tens of
    thousands of simultaneous connections. Each client process starts thousands
    of connections to the service, writes some data, read the sanswer,wait,
    close, and then open, write, ...

    Both client and server sockets are non-Blocking and use the options SO_LINGER
    to avoid letting a lot of sockets in a TIME_WAIT state. I started with a linger
    time-out of 0.

    If I kill the client processes of a host, killing so thousands of
    connections at a time, I should observe many tcp RST-flagged packets, at
    least one for every socket. But only a part of those packets are sent,
    for one half of the original number of sockets. This happens with more
    than 4 thousands of client sockets.

    If I increase the linger delay, I observe that a part of the connection
    can terminate with a FIN-flagged tcp packet (those that closes within
    the time-out), some other (that fired the timeout) with a RST-flagged
    packet, and a smaller part of the sockets still does not send any close
    packet.

    With a big enough time-out, the penomenon disappears, all the sockets can
    be cleanly closed.

    The observed effect on the server is obvious : all the badly closed sockets
    remain in ESTABLISHED state, since the server only answers to received data...
    A tcpdump shows that the close packets are not sent out the
    client host. On the client host, no kernel erro rmessage is written.

    Is there a known problem? Is there a proper workaround or a correction ?
    Did I miss something?


    Thanks a lot,

    JF Smigielski,


  2. Re: closing tcp connections on linux under heavy load

    On Mar 7, 12:27 am, Jean-Francois Smigielski
    wrote:

    > The observed effect on the server is obvious : all the badly closed sockets
    > remain in ESTABLISHED state, since the server only answers to received data...
    > A tcpdump shows that the close packets are not sent out the
    > client host. On the client host, no kernel erro rmessage is written.


    > Is there a known problem? Is there a proper workaround or a correction ?
    > Did I miss something?


    You must either send application data periodically, timeout inactive
    connections, or if all else fails enable TCP keepalives. Otherwise,
    you are designing to fail. TCP does not guarantee that an end that
    never sends data can detect a connection failure.

    DS


+ Reply to Thread