From owner-freebsd-performance@FreeBSD.ORG Thu Sep 15 02:03:26 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 996A6106566C for ; Thu, 15 Sep 2011 02:03:26 +0000 (UTC) (envelope-from jonschipp@gmail.com) Received: from mail-fx0-f54.google.com (mail-fx0-f54.google.com [209.85.161.54]) by mx1.freebsd.org (Postfix) with ESMTP id 32AA88FC12 for ; Thu, 15 Sep 2011 02:03:25 +0000 (UTC) Received: by fxg9 with SMTP id 9so249763fxg.13 for ; Wed, 14 Sep 2011 19:03:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=zSFdliVP5m9lD89pHWGR0R+Jw2EPxPrxf+gMobmycS4=; b=vRhP2ihBUlf76EtK4dhpHqhLVK2jfmwy+Znu5r02nbn9QENujTEw+RyRvMZKXzDelQ tTGCC8hEpzTNJ9f9J7Xsl09R1lASROw5ZfzbeOj9zE8vEUUstFzjAE0+0wKoPQ5GxUGp L90LSaB5RKppfbtr3gDjb7Xq5YAxxbY4bw4yo= MIME-Version: 1.0 Received: by 10.223.48.214 with SMTP id s22mr22884faf.104.1316050526932; Wed, 14 Sep 2011 18:35:26 -0700 (PDT) Received: by 10.152.2.162 with HTTP; Wed, 14 Sep 2011 18:35:26 -0700 (PDT) Date: Wed, 14 Sep 2011 21:35:26 -0400 Message-ID: From: Jon Schipp To: freebsd-performance@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: 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 02:03:26 -0000 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? Any help is appreciated. Thanks -- - Jon -- ------------------------------------------------------------------ VMB: 812-682-0231 Dubois County Linux User Group - http://www.dclinux.org Southern Indiana Computer Klub - http://sickbits.networklabs.org Bloomington FOOLS - http://www.bloomingtonfools.org/ BloomingLabs - http://www.bloominglabs.org ISSA-Kentuckiana - http://issa-kentuckiana.org GPG Key ID: 810903CB Key fingerprint = 0069 ED69 EABB DF84 5983 AD3C 6C20 BEFD 8109 03CB