Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 1 Jul 2002 11:16:37 -0400 (EDT)
From:      Andrew Gallatin <gallatin@cs.duke.edu>
To:        Don Bowman <don@sandvine.com>
Cc:        "'freebsd-stable@freebsd.org'" <freebsd-stable@FreeBSD.ORG>
Subject:   RE: number mbufs / cluster
Message-ID:  <15648.29269.138339.602900@grasshopper.cs.duke.edu>
In-Reply-To: <FE045D4D9F7AED4CBFF1B3B813C8533767664B@mail.sandvine.com>
References:  <FE045D4D9F7AED4CBFF1B3B813C8533767664B@mail.sandvine.com>

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

Don Bowman writes:
 >  
 > Doug White wrote:
 > 
 > > On Sat, 29 Jun 2002, Don Bowman wrote:
 > > 
 > > >
 > > > I have an application where there is lots of connections,
 > > > but packet sizes aren't that large. I'm running into the
 > > > problem where I need an enormous amount of clusters,
 > > > but the number of mbufs needed isn't as big:
 > > >
 > > > $ netstat -m
 > > > 141164/141200/512000 mbufs in use (current/peak/max):
 > > >         141163 mbufs allocated to data
 > > >         1 mbufs allocated to fragment reassembly queue headers
 > > > 127997/128000/128000 mbuf clusters in use (current/peak/max)
 > > > 291300 Kbytes allocated to network (10% of mb_map in use)
 > > > 121192 requests for memory denied
 > > 
 > > holy cow. How much memory does this thing have and what did you do to
 > > abuse it soo much? :-) I didn't think you could jack those values that
 > > high and not get panics.
 > > 
 > 
 > I tried changing MCLSHIFT to 10. Although this would seem like
 > the right thing to do, some trouble ensues... Some things like nfs
 > don't seem to work right (just UDP traffic as far as I could see). 
 > (10 would yield a 1K cluster). Are there
 > any assumptions somewhere that a cluster is >= MTU size?

Possibly.  What nic driver are you using?

 > Also, how does one change the number of mbufs down? The sysctl
 > value is read-only. # Mbufs seems to be a constant 4x # clusters.

You can set the boot-time tunables kern.ipc.nmbufs and 
kern.ipc.nmbclusters in /boot/loader.conf.

There's a sanity check that enfornces that nmbufs be at least 2x
nmbclusters in sys/kern/uipc_mbuf.c.

You might want to start with:

kern.ipc.nmbclusters=256000
kern.ipc.nmbufs=512000

This will use a max of 625MB of kernel memory for mbufs...

You may also need to increase the limit of the mbuf malloc type

Drew








To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




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