Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 10 Apr 2001 11:05:14 -0700 (PDT)
From:      wpaul@FreeBSD.ORG (Bill Paul)
To:        hackers@freebsd.org
Subject:   sendfile() vs. gigabit ethernet
Message-ID:  <20010410180514.E229D37B422@hub.freebsd.org>

next in thread | raw e-mail | index | archive | help
People are constantly asking me about the performance of gigabit ethernet
cards with FreeBSD. I'm constantly wishing they would all go to hell --
directly to hell, without passing "GO" or collecting $200 -- but their
persistence has led me to ask a few questions of my own. One thing everyone
notices right away is that some of FreeBSD's defaults aren't terribly
optimal for gigabit ethernet, the main one being socket buffer sizes.
At least as far as TCP is concerned, you can do one of two things:

- Change your application to call setsockopt() and increase the SO_SNDBUF
  and SO_RCVBUF values.
- Use sysctl to change the net.inet.tcp.sendspace and net.inet.tcp.recvspace
  values.

The former option affectly only a given application, while the latter
affects the entire system. Most people will bump the sendspace and
recvspace variables since it's easier than modifying their application.
Changing the default from 16K to 64K usually has a drastic effect on
performance with something like ttcp, which is what I typically use
for testing. You can also use the -B flag to ttcp to have it increase
the SNDBUF/RCVBUF values just for itself and achieve the same effect.

But then what usually happens is people will attempt to perform a file
transfer test using, of all things. FTP, and suddenly they notice that
performance doesn't really improve all that much. I could never understand
just why this was so, until I realized that /usr/libexec/ftpd in FreeBSD
now uses sendfile(). The ttcp utility on the other hand uses write(2)
(as does netperf for that matter).

So my question is: has anyone done any tests with sendfile() over a
high speed network link and tried to vary the sendspace/recvspace
defaults to improve performance? If so, does it make any difference?
My feeling is that it should, but from what I can tell, sendfile()
only passes data to sosend() in page-sized chunks, and this is somehow
negating the effect of increasing the socket buffer size. Am I right,
or am I just missing something obvious, as usual?

-Bill

=============================================================================
-Bill Paul            (925) 691-2800 | Systems Programmer, Master of Unix-Fu
                  wpaul@osd.bsdi.com | BSDi Open Source Solutions
=============================================================================
"I like zees guys. Zey are fonny guys. Just keel one of zem." -- The 3 Amigos
=============================================================================

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?20010410180514.E229D37B422>