From owner-freebsd-arch Wed Nov 6 13:40:21 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 D866B37B401 for ; Wed, 6 Nov 2002 13:40:19 -0800 (PST) Received: from mail.chesapeake.net (chesapeake.net [205.130.220.14]) by mx1.FreeBSD.org (Postfix) with ESMTP id 15E3343E3B for ; Wed, 6 Nov 2002 13:40:19 -0800 (PST) (envelope-from jroberson@chesapeake.net) Received: from localhost (jroberson@localhost) by mail.chesapeake.net (8.11.6/8.11.6) with ESMTP id gA6LeAT86865; Wed, 6 Nov 2002 16:40:10 -0500 (EST) (envelope-from jroberson@chesapeake.net) Date: Wed, 6 Nov 2002 16:40:10 -0500 (EST) From: Jeff Roberson To: Nate Lawson Cc: Terry Lambert , Subject: Re: malloc(9) performance In-Reply-To: Message-ID: <20021106163703.X1374-100000@mail.chesapeake.net> 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, Nate Lawson wrote: > 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 > I do not currently have performance numbers for malloc(9). They will not have anything at all to do with the performance of the library malloc. It has to do semi expensive system calls to do its job. I only did system level benchmarks against the old malloc and it did very well. The fast path for malloc is only the overhead of a lock, poping an item off of a stack, and an unlock. It should be quite fast. It would be trivial to write a module that would time malloc and print out some results. Could you try this? If not I can put it on my to do list. Cheers, Jeff To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message