[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: connect() taking 6 seconds?



On 7/4/05, Markus Friedl <markus_(_at_)_openbsd_(_dot_)_org> wrote:
> On Mon, Jul 04, 2005 at 04:31:43PM -0400, Adam wrote:
> > I used http_load to test out lighttpd's performance (both installed
> > from ports), and noticed that sometimes connect takes 6 seconds:

I'm seeing similar problems with 'http_load';  any suggestions for a
workaround?

If I run http_load with a high value for '-parallel' or several tests
in close succession,
the process starts to print "No route to host" warnings, from perror() after a
failed call to connect(2). 

I also found a small bug in the proxy client code, easily fixed.

> the TCP client reuses a source port and sends a SYN while the
> server still has the old TIME_WAIT state, so the server does not
> send a SYN/ACK.
> 
> after 6 seconds the client retransmits the SYN and the connect
> succeeds.
> 
> so there are 2 problems:
>        1) the client reuses the port too soon.
>        2) the server could accept the SYN during
>           TIME_WAIT (it did in the old days, but because
>           tcp clients now use random ISS the server only
>           accepts 50% of SYNs in TIME_WAIT).

I spent some time hunting for a way to reduce the duration of TIME_WAIT
state under OpenBSD 3.7, with no luck.  I suppose the next possibility to
look at is how to keep the client from reusing the port too soon?