Andre's optimization to the FreeBSD socket send path
For those who does not track FreeBSD-CURRENT -current@, Andre Opperamann (andre@) has just posted a new progress for his TCP/IP optimization:
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.diffAny testing and heavy (code) beating and reviews welcome.