From owner-freebsd-net@FreeBSD.ORG Tue Nov 13 06:23:50 2012 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1CADAFA1 for ; Tue, 13 Nov 2012 06:23:50 +0000 (UTC) (envelope-from peter@wemm.org) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 8208D8FC0C for ; Tue, 13 Nov 2012 06:23:49 +0000 (UTC) Received: by mail-lb0-f182.google.com with SMTP id gg13so1948033lbb.13 for ; Mon, 12 Nov 2012 22:23:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wemm.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Apa+dvk62p8M+/CzypQV1QAl0oNIPUm2cKtXT0F1h48=; b=dBMF38gf0DJPwaWLfBraqHLClUS/c26DRhEJRGLJz2HOQzmZuyA+8uZQz/Ytuc9lnh O2sSGfQ9xNIrH7qAx+c/ItCJG5hE19wQ4uyEFg8tJoRxd39fqXe3c22Ol/MHGuQmfHLf p5xoXdn3spdFenGwIlp1JMw1j1FU0l3xFCxc0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:x-gm-message-state; bh=Apa+dvk62p8M+/CzypQV1QAl0oNIPUm2cKtXT0F1h48=; b=LbRvJRTkk3HVtkPaUQUPWB9ungg00ghrotEUn1dSIvNpp/+ZhtGJf+be9kGMucW7kd 9daEib1uQN1paRC/BtnUNpCcACtMbDn7tR5W9xocvJAwQ/D5RNfnxXZVhZ5MFktmNM8k lG2+AZ81RWbIo818zgDRmXd3bUy5tPRMs6DBX4uryDWbg9EajR168RqQkmezZfKLSgHl jlAdNZWUSpo/BJWN9TTENj/3hD6c7Qz+d2V4tSVefjMxLqqyTfAcJ+raWu6UfbmO6C4P VoGU0V6NDcs0oqfHk5CCUiCXZ7SW2uwq7g7uIdOX17ELQiFNmFHXTTaTXzMF2+MEgciu Neqw== MIME-Version: 1.0 Received: by 10.152.106.212 with SMTP id gw20mr20492825lab.8.1352787828250; Mon, 12 Nov 2012 22:23:48 -0800 (PST) Received: by 10.112.7.41 with HTTP; Mon, 12 Nov 2012 22:23:48 -0800 (PST) In-Reply-To: <50A1E47C.1030208@mu.org> References: <50A0A0EF.3020109@mu.org> <50A0A502.1030306@networx.ch> <50A0B8DA.9090409@mu.org> <50A0C0F4.8010706@networx.ch> <50A13961.1030909@networx.ch> <50A14460.9020504@mu.org> <50A1E2E7.3090705@mu.org> <50A1E47C.1030208@mu.org> Date: Mon, 12 Nov 2012 22:23:48 -0800 Message-ID: Subject: Re: auto tuning tcp From: Peter Wemm To: Alfred Perlstein Content-Type: text/plain; charset=ISO-8859-1 X-Gm-Message-State: ALoCoQkoAWfOaZ+Zex+5nk4b4wDsO4qRyb5US5O3iok5Le5UXCL/O5BxNKB3gnRDlAoZTEsYQ4Y0 Cc: "freebsd-net@freebsd.org" , Adrian Chadd X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 13 Nov 2012 06:23:50 -0000 On Mon, Nov 12, 2012 at 10:11 PM, Alfred Perlstein wrote: > On 11/12/12 10:04 PM, Alfred Perlstein wrote: >> >> On 11/12/12 10:48 AM, Alfred Perlstein wrote: >>> >>> On 11/12/12 10:01 AM, Andre Oppermann wrote: >>>> >>>> >>>> I've already added the tunable "kern.maxmbufmem" which is in pages. >>>> That's probably not very convenient to work with. I can change it >>>> to a percentage of phymem/kva. Would that make you happy? >>>> >>> >>> It really makes sense to have the hash table be some relation to sockets >>> rather than buffers. >>> >>> If you are hashing "foo-objects" you want the hash to be some relation to >>> the max amount of "foo-objects" you'll see, not backwards derived from the >>> number of "bar-objects" that "foo-objects" contain, right? >>> >>> Because we are hashing the sockets, right? not clusters. >>> >>> Maybe I'm wrong? I'm open to ideas. >> >> >> Hey Andre, the following patch is what I was thinking >> (uncompiled/untested), it basically rounds up the maxsockets to a power of 2 >> and replaces the default 512 tcb hashsize. >> >> It might make sense to make the auto-tuning default to a minimum of 512. >> >> There are a number of other hashes with static sizes that could make use >> of this logic provided it's not upside-down. >> >> Any thoughts on this? >> >> Tune the tcp pcb hash based on maxsockets. >> Be more forgiving of poorly chosen tunables by finding a closer power >> of two rather than clamping down to 512. >> Index: tcp_subr.c >> =================================================================== > > > Sorry, GUI mangled the patch... attaching a plain text version. > > Wait, you want to replace a hash with a flat array? Why even bother to call it a hash at that point? -- Peter Wemm - peter@wemm.org; peter@FreeBSD.org; peter@yahoo-inc.com; KI6FJV "All of this is for nothing if we don't go to the stars" - JMS/B5 "If Java had true garbage collection, most programs would delete themselves upon execution." -- Robert Sewell