Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 5 Nov 1998 23:23:59 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        David Greenman <dg@root.com>
Cc:        Marc Slemko <marcs@znep.com>, cvs-committers@FreeBSD.ORG
Subject:   Re: sendfile()
Message-ID:  <199811060723.XAA01903@apollo.backplane.com>
References:   <Pine.BSF.4.03.9811052158470.11835-100000@alive.znep.com>

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

: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.
    <dillon@backplane.com> (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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199811060723.XAA01903>