Much improved sendfile(2), sosend_* and soreceive_stream() functions

Andre Oppermann andre at freebsd.org
Fri Oct 6 10:05:43 PDT 2006


This is a continuation of the previous postings with similiar titles.

New is a specific soreceive_stream() function for stream protocols (primarily TCP)
that does only one socket buffer lock per socket read instead of one per data mbuf
copied to userland.  When doing netperf tests with WITNESS (full lock tracking and
validation enabled) the receive performance increases from ~360Mbit/s to ~520Mbit/s.
Without WITNESS I could not measure any statistically significant improvement on a
otherwise unloaded machine.  The reason is two-fold: 1) per packet we do a wakeup
and readv() is pretty much as many times as packets come it, thus the general over-
head dominates; 2) the packet input path has a pretty high overhead too.  On heavily
loaded machines which do a lot of high speed receives a performance increase should
be measureable.

This patch rolls the improved sendfile(2), sosend_*() and soreceive_stream()
functions.  In general the send path is improved by between 2.8 and 5.7 times.

The patch is available here:
  http://people.freebsd.org/~andre/sendfile+sosend+soreceive-20061006.diff

Any testing and heavy (code) beating and reviews welcome.

-- 
Andre


More information about the freebsd-current mailing list