|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : Eugene Grosbein 2:5006/1 21 Sep 2006 09:43:53 To : All Subject : Much improved sendfile(2) kernel implementation --------------------------------------------------------------------------------
Привет!
/****************************************
From: Andre Oppermann <andre@freebsd.org>
The recent addition of TSO (TCP Segmentation Offload) has highlighted some
shortcommings in our sendfile(2) kernel implementation. The current code
simply loops over the file, turns each 4K page into an mbuf and sends it
off. This has the effect that TSO can only generate 2 packets per send
instead of up to 44 at its maximum of 64K.
I have rewritten kern_sendfile() to work in two loops, the inner which turns
as many pages into mbufs as it can up to the free send socket buffer space.
The outer loop then drops the whole mbuf chain into the send socket buffer,
calls tcp_output() on it and then waits until 50% of the socket buffer are
free again to repeat the cycle. This way tcp_output() gets the full amount
of data to work with and can issue up to 64K sends for TSO to chop up in the
network adapter without using any CPU cycles. Thus it gets very efficient
especially with the readahead the VM and I/O system do.
Looking at the benchmarks we see some very nice improvements (95%
confidence):
45% less cpu (or 1.81 times better) with new sendfile vs. old sendfile
(non-TSO)
83% less cpu (or 5.7 times better) with new sendfile vs. old sendfile (TSO)
The sender is an AMD Opteron 852 (2.6GHz) with em(4) PCI-X-133 interface and
the receiver is a DELL Poweredge SC1425 P-IV Xeon 3.2GHz with em(4) LOM
connected
back to back at 1000Base-TX full duplex.
The patch is available here:
http://people.freebsd.org/~andre/sendfile-20060920.diff
Any testing and heavy (code) beating and reviews welcome.
****************************************/
Eugene
--
Choose no friends
--- slrn/0.9.8.0 (FreeBSD)
* Origin: Svyaz Service JSC (2:5006/1@fidonet)
Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/260936ea61de8.html, оценка из 5, голосов 10
|