Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 06 Dec 2000 15:30:15 -0500 (EST)
From:      Bosko Milekic <bmilekic@technokratis.com>
To:        Ferdinand Goldmann <ferdl@atommuell.oeh.uni-linz.ac.at>
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: hints on mbuf calculation needed
Message-ID:  <Pine.BSF.4.21.0012061521100.11738-100000@jehovah.technokratis.com>
In-Reply-To: <Pine.BSF.4.21.0012051337280.15517-100000@atommuell.oeh.uni-linz.ac.at>

next in thread | previous in thread | raw e-mail | index | archive | help

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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0012061521100.11738-100000>