Kamran Karimi wrote:

>  I have a benchmark program that uses connect() to create TCP/IP connctions 
> between two Linux boxes as fast as it can. After a connection is open, 
> some data is transferred, the socket is closed, the next socket is 
> created, and so on.
> 
>  This works fine between slow machines. But when I run it on faster machines 
> (where sockets are created and closed something like 250 times a second), 
> after a while (about 3500 socket open/close operations) connect() fails 
> with a "resource temporarily unavailable" error message. Other services 
> like ftp stop working too.
> 
>  Is my program as fault here, or is this a kernel limitation?

AFAICT, it's somewhere between a kernel limitation and a TCP
limitation.

What I presume is happening is that whichever port number is chosen
for the client end will produce a socket which conflicts with one
which is in the TIME_WAIT state.

> Can I avoid this problem without having to limit the number of
> connections in my benchmark program?

On 2.2.*, you can increase the number of ephemeral ports available by
writing to /proc/sys/net/ipv4/ip_local_port range.

However, this will only make the problem harder to trigger.
Ultimately, if you make connections fast enough you will run into the
fact that TCP only uses 16-bit port numbers.

-- 
Glynn Clements <[EMAIL PROTECTED]>

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to