Subject: Re: fixing send(2) semantics (kern/29750)
To: Emmanuel Dreyfus <manu@netbsd.org>
From: Jason Thorpe <thorpej@shagadelic.org>
List: tech-kern
Date: 03/27/2005 00:03:10
On Mar 26, 2005, at 10:37 PM, Emmanuel Dreyfus wrote:

> The app needs to send UDP packets as fast as possible. I want to  
> use the
> full network bandwidth for sending UDP packets. The only congestion  
> that
> exists here is internal to the machine because the CPU can put more
> entries in the interface queue than the network can handle.
>
> Currently, there is no way at all to get send(2) block until it can
> really send the data. For now, from the application perspective, the
> only way to go is to get ENOBUFS and sleep between sends to let the
> interface absorb the data.

But UDP is "best effort".  You can't guarantee that the data will  
ever arrive at the other side,  either.

> In my situation, a single system call is enough to slow down the  
> app so
> that the interface absorbs the data, but then the app is not able
> anymore to maintain the interface queue full, thus it cannot use the
> full network bandwidth.
>
> How can I fix the app? Without sleeping between sends, I get  
> ENOBUFS, I
> have to retry the send, and that slows down the app enough so that it
> canot maintain the interface queue full, and thus it cannot use the  
> full
> network bandwidth either.

What app is this?  Why doesn't it use TCP, which would not have this  
problem?

-- thorpej