From owner-cvs-all Thu Nov 5 23:24:18 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id XAA27784 for cvs-all-outgoing; Thu, 5 Nov 1998 23:24:18 -0800 (PST) (envelope-from owner-cvs-all@FreeBSD.ORG) Received: from apollo.backplane.com (apollo.backplane.com [209.157.86.2]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id XAA27777 for ; Thu, 5 Nov 1998 23:24:16 -0800 (PST) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.9.1/8.9.1) id XAA01903; Thu, 5 Nov 1998 23:23:59 -0800 (PST) (envelope-from dillon) Date: Thu, 5 Nov 1998 23:23:59 -0800 (PST) From: Matthew Dillon Message-Id: <199811060723.XAA01903@apollo.backplane.com> To: David Greenman Cc: Marc Slemko , cvs-committers@FreeBSD.ORG Subject: Re: sendfile() References: Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk :sendfile() certainly helped wcarchive, which is a good example of this. :Zero copy technology helped IBM push numbers on their quad CPU system :until they actually ran out of bandwidth on the bus with a fair amount of :... Heh. Well, I wrote a little program to test the overhead of sendfile() vs write() in the 100% cached case. The program makes a tcp connection to another program that just sinks the data. Over localhost (with the sink program running on the same host), it's 9x more efficient to use sendfile(). Over a 10BaseT Lan (with the sink program running on the remote host) it's 2x and 2.8x more efficient using sendfile(). But sendfile() does not apparently handle O_NONBLOCK descriptors right. This is very important, I think. Dave? We can't use sendfile() in multi-threaded select() cores without that. Right now it operates as if O_NONBLOCK hadn't been specified. The programs I am using are available at: http://www.backplane.com/FreeBSD/ -Matt (send to localhost, sink program running on localhost. Note user + system time ... sendfile() is 9x more efficient) # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -sendfile -r64 -b4096 0.040u 0.275s 0:02.08 14.9% 5+191k 0+0io 0pf+0w # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -sendfile -r64 -b16384 0.017u 0.279s 0:01.99 14.0% 4+184k 0+0io 0pf+0w # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -sendfile -r64 -b0 0.012u 0.153s 0:01.94 8.2% 6+247k 0+0io 0pf+0w # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -write -r64 -b4096 0.078u 2.746s 0:03.58 78.4% 6+198k 0+0io 0pf+0w # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -write -r64 -b16384 0.029u 2.387s 0:03.26 73.6% 5+209k 0+0io 0pf+0w # time ./tcpsendfile localhost 5400 /usr/lib/libc_pic.a -write -r64 -b65536 0.029u 2.207s 0:04.18 53.1% 5+206k 0+0io 0pf+0w (send to host on 10BaseT lan, sink program running on remote. 2x more efficient in this case.) (Using 16K send/recvpipes via route command) # time ./tcpsendfile lander 5400 /usr/lib/libc_pic.a -r8 -s -b4096 -write 0.029u 0.519s 0:08.94 5.9% 9+170k 0+0io 0pf+0w # time ./tcpsendfile lander 5400 /usr/lib/libc_pic.a -r8 -s -b4096 -sendfile 0.017u 0.256s 0:08.90 2.9% 15+284k 0+0io 0pf+0w (Using 64K send/recvpipes via route command, 2.8x more efficient in this case). # time ./tcpsendfile lander 5400 /usr/lib/libc_pic.a -r8 -s -b4096 -write 0.024u 0.538s 0:09.00 6.1% 10+196k 0+0io 0pf+0w # time ./tcpsendfile lander 5400 /usr/lib/libc_pic.a -r8 -s -b4096 -sendfile 0.026u 0.172s 0:08.93 2.1% 36+276k 0+0io 0pf+0w Matthew Dillon Engineering, HiWay Technologies, Inc. & BEST Internet Communications & God knows what else. (Please include original email in any response) To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message