Mbuf errors
Eric Anderson
anderson at centtech.com
Wed Nov 24 11:17:07 PST 2004
Akhthar Parvez. K wrote:
> Hi All,
>
> Mysql service is going down continously in my system due to lack of memory
> space.
>
> I checked the messages log and found the following error message.
>
> All mbuf clusters exhausted, please see tuning(7).
>
> I have no idea about mbuf cluster. Can anyone please help me to fix the issue.
>
> I hope the information below will help you.
[..snip..]
> Following is the output of netstat -m
>
> 3797/14672/26624 mbufs in use (current/peak/max):
> 3791 mbufs allocated to data
> 2 mbufs allocated to fragment reassembly queue headers
> 4 mbufs allocated to socket names and addresses
> 3704/6656/6656 mbuf clusters in use (current/peak/max)
> 16980 Kbytes allocated to network (85% of mb_map in use)
> 106522 requests for memory denied
> 1545 requests for memory delayed
> 0 calls to protocol drain routines
>
> Please let me know if you need more info regarding this.
> Thank you in advance.
This isn't really security related, more performance related, so I'm
moving it to that list (freebsd-performance@).
The answer to your question is right in your email! In the tuning man
page, it says:
kern.ipc.nmbclusters may be adjusted to increase the number of network
mbufs the system is willing to allocate. Each cluster represents
approx-
imately 2K of memory, so a value of 1024 represents 2M of kernel
memory
reserved for network buffers. You can do a simple calculation to
figure
out how many you need. If you have a web server which maxes out
at 1000
simultaneous connections, and each connection eats a 16K receive
and 16K
send buffer, you need approximately 32MB worth of network buffers
to deal
with it. A good rule of thumb is to multiply by 2, so 32MBx2 =
64MB/2K =
32768. So for this case you would want to set kern.ipc.nmbclusters to
32768. We recommend values between 1024 and 4096 for machines
with mod-
erates amount of memory, and between 4096 and 32768 for machines with
greater amounts of memory. Under no circumstances should you
specify an
arbitrarily high value for this parameter, it could lead to a
boot-time
crash. The -m option to netstat(1) may be used to observe network
clus-
ter use. Older versions of FreeBSD do not have this tunable and
require
that the kernel config(8) option NMBCLUSTERS be set instead.
More and more programs are using the sendfile(2) system call to
transmit
files over the network. The kern.ipc.nsfbufs sysctl controls the
number
of file system buffers sendfile(2) is allowed to use to perform
its work.
This parameter nominally scales with kern.maxusers so you should
not need
to modify this parameter except under extreme circumstances. See the
TUNING section in the sendfile(2) manual page for details.
So basically you need to use sysctl to adjust (increase) the
kern.ipc.nmbclusters number.
Eric
--
------------------------------------------------------------------------
Eric Anderson Sr. Systems Administrator Centaur Technology
When in doubt, mumble; when in trouble, delegate; when in charge, ponder
------------------------------------------------------------------------
More information about the freebsd-security
mailing list