From owner-freebsd-performance@FreeBSD.ORG Thu Sep 15 05:10:47 2011 Return-Path: Delivered-To: freebsd-performance@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B012F106566B for ; Thu, 15 Sep 2011 05:10:47 +0000 (UTC) (envelope-from julian@freebsd.org) Received: from vps1.elischer.org (vps1.elischer.org [204.109.63.16]) by mx1.freebsd.org (Postfix) with ESMTP id 6FAF28FC0A for ; Thu, 15 Sep 2011 05:10:47 +0000 (UTC) Received: from julian-mac.elischer.org (home-nat.elischer.org [67.100.89.137]) (authenticated bits=0) by vps1.elischer.org (8.14.4/8.14.4) with ESMTP id p8F4Wfim033993 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Wed, 14 Sep 2011 21:32:50 -0700 (PDT) (envelope-from julian@freebsd.org) Message-ID: <4E71800B.3080808@freebsd.org> Date: Wed, 14 Sep 2011 21:33:15 -0700 From: Julian Elischer User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.4; en-US; rv:1.9.2.22) Gecko/20110902 Thunderbird/3.1.14 MIME-Version: 1.0 To: Jon Schipp References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-performance@freebsd.org Subject: Re: Zero-Copy for packet capture and mbuf question X-BeenThere: freebsd-performance@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Performance/tuning List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 15 Sep 2011 05:10:47 -0000 On 9/14/11 6:35 PM, Jon Schipp wrote: > Has anyone used the zero-copy mechanism for an increased performance in > packet capturing? > I'm on FreeBSD 8.2-RELEASE, I was thinking about trying it. It's for a > network monitoring system, it just grabs and dumps all data > from all my network segments. I've noticed improvements by increasing the > bpf buf size and maxbufsize which in turned increased the > initial buffer size for libpcap. I'm dropping less now. > > In 8.2, is turning on zero-copy as simple as changing the value of > net.bpf.zerocopy_enable? > http://node5.blogspot.com/2009/11/very-quick-look-at-zero-copy-bpf-in.html > I can't seem to find much information that shows that it's this simple. > Right now it seems that if I want to use zero-copy for sends > I would have to recompile the kernel with: options ZERO_COPY_SOCKETS > But for receives, which is only what I'm concerned about, it seems that I > just turn it on via sysctl. > > *I see that in 9.0 it will be on by default* > > Another question: I'm assuming all packets get copied to an mbuf from the > NIC and then copied again to the bpf device/bpf buffer. Can anyone verify > this? > I don't think raising my mbufs will help, since a few hundred are free > during peak hours. Will increasing the amount of mbuf clusters (nmbclusters) > only help when you are pushing the threshold i.e. running out? Also, out of > curiousity, is it possible to increase the amount of mbufs as opposed to the > amount of mbuf clusters? if you really want high performance packet capture and you are running one of the supported cards, see Luigi's work at: http://info.iet.unipi.it/~luigi/netmap/ > Any help is appreciated. > Thanks