From owner-freebsd-arch Wed Nov 6 13:21:30 2002 Delivered-To: freebsd-arch@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id D852637B401 for ; Wed, 6 Nov 2002 13:21:29 -0800 (PST) Received: from rootlabs.com (root.org [67.118.192.226]) by mx1.FreeBSD.org (Postfix) with SMTP id 14F3743E42 for ; Wed, 6 Nov 2002 13:21:29 -0800 (PST) (envelope-from nate@rootlabs.com) Received: (qmail 15878 invoked by uid 1000); 6 Nov 2002 21:21:29 -0000 Date: Wed, 6 Nov 2002 13:21:29 -0800 (PST) From: Nate Lawson To: Terry Lambert Cc: arch@freebsd.org Subject: Re: malloc(9) performance In-Reply-To: <3DC983D9.B94F1474@mindspring.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Wed, 6 Nov 2002, Terry Lambert wrote: > Nate Lawson wrote: > > (*) For me, fast enough means sustaining 100000 small (400 byte) and big > > (64k) allocations/frees per second (one every 10 us). Maximum memory in > > use at any point in time would be a few MB. Latency is my main concern > > and memory fragmentation much less so. > > For me, the number is closer to 600,000: theoretically, this should > be the combined mbuf and tcpcb connection struct allocation rate, > given the maximum possible connection per second rate on a Gigabit > ethernet's packets-per-secon throughput. I'm going to get really flamed for this but I did a short test of the userland malloc and found that I get 33000 mallocs/sec when grabbing 64k (and then touching one byte on each page) compared to 1800/s when I add in the small mallocs (one 608 byte, one 400 byte). So I may be sticking with a private freelist for the small allocations and use malloc for the large buf. Of course, profiling and real tests would be much better but I just need to make a quick decision for now. -Nate To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message