why zero-copy sockets(9) are not popular?
Bruce Simpson
bms at incunabulum.net
Sat Mar 20 17:53:41 UTC 2010
On 03/20/10 10:06, Alexander Bubnov wrote:
> Hello, all!
> Anybody knows why zero copy is not popular although this technique allows
> to increase performance of servers? It is very hard to find any examples of
> zero-copy for FreeBSD.
>
Transmit is easy. Receive is hard.
The whole concept of zero-copy revolves around being able to use
page-flipping to map buffers in user and kernel space, to amortize the
cost of copies across that system boundary.
The compromise usually taken is to use the sendfile() API, or rely on
TCP Segmentation Offload (TSO), much like Microsoft's Chimney stack does
in Windows 7. Unfortunately, sendfile() only covers transmit. TSO only
offloads up to the point where sockets hit the card; TSO can offload TCP
stream reassembly, but you still have to copy from the kernel buffers
into userland.
True zero-copy sockets generally require scatter/gather DMA engine
support, and TCP/IP header splitting, to do zero-copy recieve.
S/G PCI DMA cores are often custom designed, and you tend not to find
them in off-the-shelf VHDL libraries. That IP (as in intellectual
property) still has cost.
Historically the only cards in FreeBSD which supported this, were the
Tigon-II, which got bought by Broadcom (bge is the Tigon-III). Modified
firmware was required to do this.
More information about the freebsd-net
mailing list