Subject: Re: fixing send(2) semantics (kern/29750)
To: Jonathan Stone <jonathan@dsg.stanford.edu>
From: Emmanuel Dreyfus <manu@netbsd.org>
List: tech-kern
Date: 03/27/2005 08:37:38
Jonathan Stone <jonathan@dsg.stanford.edu> wrote:
> I think you'd be better off to fix your application, instead of
> pursuing a (well-meant, but deeply misguided) attempt to "fix" the
> BSD networking code.
About fixing the app to workaround the current bhavior of send(2): I
don't see any workaround for the problem at the application level. I'm
interested if you have one.
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.
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.
--
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu@netbsd.org