From owner-freebsd-net Wed Dec 6 12:32: 0 2000 From owner-freebsd-net@FreeBSD.ORG Wed Dec 6 12:31:55 2000 Return-Path: Delivered-To: freebsd-net@freebsd.org Received: from falla.videotron.net (falla.videotron.net [205.151.222.106]) by hub.freebsd.org (Postfix) with ESMTP id 2E33037B404 for ; Wed, 6 Dec 2000 12:31:55 -0800 (PST) Received: from modemcable213.3-201-24.mtl.mc.videotron.ca ([24.201.3.213]) by falla.videotron.net (Sun Internet Mail Server sims.3.5.1999.12.14.10.29.p8) with ESMTP id <0G5500MMLY8WBY@falla.videotron.net> for freebsd-net@FreeBSD.ORG; Wed, 6 Dec 2000 15:29:20 -0500 (EST) Date: Wed, 06 Dec 2000 15:30:15 -0500 (EST) From: Bosko Milekic Subject: Re: hints on mbuf calculation needed In-reply-to: To: Ferdinand Goldmann Cc: freebsd-net@FreeBSD.ORG Message-id: MIME-version: 1.0 Content-type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Tue, 5 Dec 2000, Ferdinand Goldmann wrote: > Greetings. > > I have three questions about the value of NMBCLUSTERS: > > - Is there any way to tell in advance how high I need to set this value to > have enough? I.e., I have a machine which does forwarding to a proxy and > firewalling/traffic shaping for about 6-700 clients, no local users - > how high should the value of NMBCLUSTERS be? > Current usage is: > $ netstat -m > 748/1360/16384 mbufs in use (current/peak/max): > 163 mbufs allocated to data > 585 mbufs allocated to packet headers > 163/582/4096 mbuf clusters in use (current/peak/max) > 1504 Kbytes allocated to network (12% of mb_map in use) > 0 requests for memory denied > 0 requests for memory delayed > 0 calls to protocol drain routines > > This short after a reboot, the value of mbuf clusters rises to ~2000 after > some time. Personally, I would crank NMBCLUSTERS up to 8192 in this case, just to be safe. Plus, it doesn't really cost you much to increase them just a bit, as all you're really losing is a rather insignificant amount of address space. > - Memory consumption: How much memory does one mbuf eat up? I'd like to > have a formula to answer the question "I have 32MB RAM, how many NMBCLUSTERS > can I compile into my kernel until that RAM will be eaten up?" This shouldn't be the way you determine to what to set NMBCLUSTERS to. Your first point above shows a much more effective way to do it. But to answer your question, an mbuf is presently 256 bytes and an mbuf cluster is 2KB. > - What's the difference between 'mbuf' and 'mbuf clusters' *blush*? I think that the mbuf(9) man page should clear up quite a few points. Although, the man page is only available in -CURRENT so if you don't run -CURRENT, you should be able to find it via the FreeBSD web site. Specifically: "An mbuf is a basic unit of memory management in the kernel IPC subsystem." and "If small enough, data is stored in the mbuf's internal data buffer. If the data is sufficiently large, another mbuf may be added to the chain or external storage may be associated with the mbuf. MHLEN bytes of data can fit into an mbuf with the M_PKTHDR flag set, MLEN bytes can otherwise." ... "The system also supplies a default type of external storage buffer called an ``mbuf cluster''." > Regards, > Ferdinand Goldmann Cheers, Bosko Milekic bmilekic@technokratis.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message