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

Re: [leafnode-list] Can fetchnews un-buffer stdout?



Stefan Wiens <s.wi@xxxxxxx> writes:

> Matthias Andree <ma@xxxxxxxxxxxxxxxxxxxxxxxxxxxx> writes:
> 
> > You mean: that's why stdio is not really suited for network
> > applications? That's what it boils down to.
> 
> I built a line-buffered leafnode.
> On a P200 Box with Linux 2.2.17, the full-buffered version transmits
> 5.6 MB/s after LIST ACTIVE, the line-buffered one 2.6 MB/s.
> In either case, CPU power limits the data rate:
> Both cause 99% CPU load; I think stdio isn't the only reason.

There's something awry, leafnode (the nntpd) should not be able to load
a Pentium 200.

> Most interesting, line buffered mode actually results in larger
> average packet size. There seems to be some additional buffering in
> the kernel. ;-)

Yes. man tcp(7): "TCP does not preserve record boundaries."

If you want to push (in TCP/IP terms) the packets, you need TCP_NODELAY.

> > Systems that support it (Linux, FreeBSD) should use sendfile anyways to
> > reduce copying things around.
> 
> Leafnode's no FTP server. ;-)

No, but look closely:
Linux:
sendfile (2)         - transfer data between file descriptors
FreeBSD:
sendfile(2) - send a file to a socket

If the articles are stored in the proper format, you can just have the
kernel care for the entire sending; if you know the header/body sizes,
you can use sendfile for HEAD or BODY as well, not only for ARTICLE.

-- 
Matthias Andree

-- 
leafnode-list@xxxxxxxxxxxxxxxxxxxxxxxxxxxx -- mailing list for leafnode
To unsubscribe, send mail with "unsubscribe" in the subject to the list