From owner-freebsd-hackers Tue Apr 23 6:17: 3 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from scribble.fsn.hu (scribble.fsn.hu [193.224.40.95]) by hub.freebsd.org (Postfix) with SMTP id F0F2837B404 for ; Tue, 23 Apr 2002 06:16:55 -0700 (PDT) Received: (qmail 25869 invoked by uid 1000); 23 Apr 2002 13:19:22 -0000 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 23 Apr 2002 13:19:22 -0000 Date: Tue, 23 Apr 2002 15:19:21 +0200 (CEST) From: Attila Nagy To: Terry Lambert Cc: hackers@freebsd.org Subject: Re: sendfile() in tftpd? In-Reply-To: <3CC53D18.577A9A67@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Hello, > Only if all file transfers were binary, or all ASCII files were stored > on the host with line termination, instead of . 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