Re: writev() inefficiency

Dean Gaudet (
Mon, 27 Jan 1997 10:54:26 -0800 (PST)

This was with libc-5.4.17, and linux-2.0.27 (I built libc myself, maybe I
screwed up). The data was two 100 byte buffers...

Nope didn't screw up, from strace of that test program:

writev(3, [{"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 100}, {"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"..., 100}], 2) = 200

Setting TCP_NODELAY didn't help -- still split into two packets.


On Sun, 26 Jan 1997, Alan Cox wrote:

> Linux will normally coallesce writev() in accordance with the protocol. It
> always does this for UDP, and RAW sockets. For TCP you will see the same
> but the data may be split according to Nagle and maximum fragment sizes
> Old libc's emulate writev() rather than using the later kernel writev()
> and this causes the behaviour you describe. Try again with 2.0.x and
> libc5.3.12