免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1373 | 回复: 0
打印 上一主题 下一主题

FreeBSD之"All mbuf clusters exhausted"问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2007-03-30 23:25 |只看该作者 |倒序浏览
/kernel: All mbuf clusters exhausted, please see tuning(7). 解决
mail#tail -f /var/log/messages
Jul  1 11:28:06 mail /kernel: All mbuf clusters exhausted, please see tuning(7).
Jul  1 11:28:06 mail pdns[198]: Error sending reply with sendto (socket=7): No buffer space available
Jul  1 11:28:07 mail last message repeated 5 times
Jul  1 11:28:07 mail /kernel: All mbuf clusters exhausted, please see tuning(7).
Jul  1 11:28:07 mail pdns[198]: Error sending reply with sendto (socket=7): No buffer space available
Jul  1 11:28:08 mail /kernel: All mbuf clusters exhausted, please see tuning(7).
Jul  1 11:28:39 mail last message repeated 29 times
Jul  1 11:30:40 mail last message repeated 105 times
Jul  1 11:32:52 mail last message repeated 111 times
Jul  1 12:39:52 mail pdns[198]: On retrieving question of packet from
218.56.161.69, encountered error: Label claims to be longer than packet
mail# dmesg
All mbuf clusters exhausted, please see tuning(7).
All mbuf clusters exhausted, please see tuning(7).
...........................
mail# netstat -m
37/3840/10048 mbufs in use (current/peak/max):
        37 mbufs allocated to data
32/2512/2512 mbuf clusters in use (current/peak/max)
5984 Kbytes allocated to network (79% of mb_map in use)
17044 requests for memory denied
828 requests for memory delayed
0 calls to protocol drain routines
将会满屏都是
从上面可以看出,All mbuf clusters exhausted,查原因得知,由于缺省的kern.ipc.nmbclusters比较小,以致于某些东东需要分配时得不到。延时828个。
俺查到:kern.ipc.nmbclusters可以调整用来增加系统愿意申请的网络mbuf的数量。每个cluster(簇)大概2K的内存,所以值
1024代表保留2M内核内存作为网络缓冲区。你可以简单的计算出需要多少。如果你有一个web服务器最多可以有1000个并发连接,每个连接吃掉16K
接收和发送缓冲区,你大概需要32MB的网络缓冲区来对付它。一个比较粗糙的方法是乘以2,所以32MBx2 = 64MB/2K =
32768。所以这个情况下你将需要设置nmbclusters到32768。我们建议为那些内存不多的机器设置1024到4096而4096到
32768为那些有很多内存的机器。无论如何如何你不能设置一个很随意的值,这可能导致启动时崩溃。netstat(1)的-m选项可以用来查看网络缓冲
区的使用情况。老的FreeBSD系统没有这个sysctl,所以需要设置内核配置选项NMBCLUSTERS。
于上/boot/defaults/load.conf文件中增加了kern.ipc.nmbclusters="16384" ,重启可解决。因为俺是邮件服务器兼DNS,没必要整那么大。
另外,在/sys/i386/conf/的LINT文件中有这样一段:
options         NBUF=512
# Set the size of the mbuf KVM reservation, in clusters.  This is scaled
# by approximately 2048 bytes.  The system will auto-size the mbuf area
# to (512 + maxusers*16) if this option is not specified.
# maxusers is in turn computed at boot time depending on available memory
# or set to the value specified by "options MAXUSERS=x" (x=0 means
# autoscaling).
# So, to take advantage of autoscaling, you have to remove both
# NMBCLUSTERS and MAXUSERS (and NMBUFS) from your kernel config.
#
options         NMBCLUSTERS=1024
# Set the number of mbufs available in the system. Each mbuf
# consumes 256 bytes. The system will autosize this (to 4 times
# the number of NMBCLUSTERS, depending on other constraints)
# if this option is not specified.
传说改这个也是有效的。
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/2389/showart_268494.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP