Date: Fri, 13 Nov 1998 09:25:22 -0800 (PST) From: Matthew Dillon <dillon@apollo.backplane.com> To: Dru Nelson <dnelson@redwoodsoft.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: write syscall times for sockets Message-ID: <199811131725.JAA05134@apollo.backplane.com> References: <Pine.BSF.3.91.981112155956.4572L-300000@pacman.redwoodsoft.com>
next in thread | previous in thread | raw e-mail | index | archive | help
:Hi,
:
: I wrote a simple C program to guage how many usec's
: system calls take or write calls take for various
: write lengths.
:
: I setup a socket to the discard socket on another machine.
: I did various writes. The times are in the attachment.
: The first 4 writes are 0,0,8,?. After that all the writes
: are in groups of 4 with a sleep(2) in between.
: Ahh.. :-) I'll just include the code.
:
: Basically, the first system call would take longer for some
: reason. Then each write would be pretty consistent.
Well, amoung other things, the system must initially fault
the buffer into memory, whether it's zero-page or not.
: What I was looking for was that characteristic of writing
: to a socket with buffer available. The call should be pretty
In order to test this properly you also need to take into
account the TCP window size and kernel buffering. The
combination determines how much unacked data the destination
is willing to accept and how much data the source is willing to
buffer in the kernel.
You can control the parameter somewhat on the source with
a socket option SO_SNDBUF and SO_SNDLOWAT (see 'setsockopt'),
you can set system-wide defaults with sysctl (sysctl -a | fgrep tcp),
and you can set per-route specifics with route (e.g.
route -n get default; route -n change default -sendpipe 60000,
and so on). For the tests you are making, it should be
sufficient to set it just on the sender's side.
You might also be interested in the new sendfile() functionality
just recently added by David Greenman to FreeBSD.
-Matt
: This is pretty much for fun... a limited test case. However,
: I think the information would be interesting.
:
: I'm not on this list, so if you could cc: me when you reply,
: that would be great.
:
:Dru Nelson
:Redwood City, California
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 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?199811131725.JAA05134>
