mbufs exhausted

Giorgos Keramidas keramida at ceid.upatras.gr
Tue Apr 8 20:48:04 PDT 2003

On 2003-04-08 07:53, Jon Reynolds <jonr at destar.net> wrote:
> I am getting the message "mbufs exhausted please see tuning". So, I
> saw tuning. What file can you change the mbufs in? I remeber it being
> in /etc but not which config file it was.
> Also, would adding 'NMBCLUSTERS=4096' to the end of my kernel be ok?
> Whats the highest value I can set this too? I found inside of 'LINT'
> that mbufs would size itself 4x that of 'NMBCLUSTERS' if the NMBUFS
> option is not specified. So would this help the errors that I am
> getting?

Each packet that is received from or sent by your FreeBSD kernel is
stored while in transit in one or more "mbufs".  You can see how many
are in use any time with sysctl and netstat:

    $ sysctl -a | grep nmbufs
    kern.ipc.nmbufs: 34432

    $ sysctl -a | grep nmbcl
    kern.ipc.nmbclusters: 17216

    $ netstat -m
    mbuf usage:
            GEN cache:      0/0 (in use/in pool)
            CPU #0 cache:   25/64 (in use/in pool)
            Total:          25/64 (in use/in pool)
            Mbuf cache high watermark: 512
            Mbuf cache low watermark: 128
-->         Maximum possible: 34432
            Allocated mbuf types:
-->           25 mbufs allocated to data
            0% of mbuf map consumed
    mbuf cluster usage:
            GEN cache:      0/0 (in use/in pool)
            CPU #0 cache:   0/64 (in use/in pool)
            Total:          0/64 (in use/in pool)
            Cluster cache high watermark: 128
            Cluster cache low watermark: 16
-->         Maximum possible: 17216
            0% of cluster map consumed
    144 KBytes of wired memory reserved (4% in use)
    0 requests for memory denied
    0 requests for memory delayed
    0 calls to protocol drain routines

It's easy to see that kern.ipc.nmbufs is reported by netstat as the
"maximum possible" value for allocated mbufs, while the value of the
kern.ipc.nmbclusters sysctl is reported as the "maximum possible"
number of mbuf clusters.

The size of an mbuf is very small when compared to the size of an "mbuf
cluster".  If the output of netstat shows that you're running out of
mbufs but not out of clusters you should only increase NMBUFS.  If
they're both running out, you should probably increase NMBCLUSTERS and
let NMBUFS pick up the change from there.

- Giorgos

More information about the freebsd-questions mailing list