Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 23 Apr 2002 15:19:21 +0200 (CEST)
From:      Attila Nagy <bra@fsn.hu>
To:        Terry Lambert <tlambert2@mindspring.com>
Cc:        hackers@freebsd.org
Subject:   Re: sendfile() in tftpd?
Message-ID:  <Pine.LNX.4.44.0204231427560.24266-100000@scribble.fsn.hu>
In-Reply-To: <3CC53D18.577A9A67@mindspring.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Hello,

> Only if all file transfers were binary, or all ASCII files were stored
> on the host with <CR><LF> line termination, instead of <LF>. That's the
> same reason sendfile() is stupid for POP3, IMAP4, and SMTP servers...
Hmm. Both FTP and TFTP supports ASCII and binary transfers, am I right?
In libexec/ftpd this case is handled this way:
	case TYPE_A:
		while ((c = getc(instr)) != EOF) {
	[...]
	case TYPE_L:
	[...]
		while (err != -1 && filesize > 0) {
			err = sendfile(filefd, netfd, offset, 0,
			(struct sf_hdtr *) NULL, &cnt, 0);
	[...]

As far as I can determine.

In libexec/tftpd there is also a similar possibility to handle each case,
because there is "netascii" and "octet".

We have a lab here with machines, which have NICs with built-in bootrom
(Intel PRO/100) and run bpbatch (http://www.bpbatch.org/). During the
startup the user gets a nice menu from which he/she can choose the OS
(various Windows versions for the education and Linux). After this the
program checks the image on the harddisk and if it fails it gets from the
network.
And that's what isn't too good. One client can achieve about 15 Mbps but
if more than 10 (usually 20-30) clients want to fetch the images the TFTP
server first slows down (it eats all the CPU of the server, which is a
fast AthlonXP 1600+) then times out.

I think this could be improved if TFTP could use sendfile().
(I have a busy FTP server and I know how much sendfile() can speed up
things)

The main question here seems to be: could sendfile() be used with UDP, or
it is just for TCP?

BTW, the bpbatch stuff uses binary transfer (according to tcpdump
output)...

--------[ Free Software ISOs - ftp://ftp.fsn.hu/pub/CDROM-Images/ ]-------
Attila Nagy					e-mail: Attila.Nagy@fsn.hu
Free Software Network (FSN.HU)		  phone @work: +361 210 1415 (194)
						cell.: +3630 306 6758


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.44.0204231427560.24266-100000>