代理服务器出现故障-mbuf

第三天下午(2005-01-19) netstat -m

$ date
Wed Jan 19 14:37:02 CST 2005
$ netstat -m
706/3856/131072 mbufs in use (current/peak/max):
        604 mbufs allocated to data
        102 mbufs allocated to packet headers
598/3770/32768 mbuf clusters in use (current/peak/max)
8504 Kbytes allocated to network (8% of mb_map in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines

,继续正常.

另外, 上次增加mbuf是在/boot/defaults/load.conf文件中增加了kern.ipc.nmbclusters="32768" , 今天看了一位前辈的kernel, 才知道也可以在内核中加入的. 

options        NMBCLUSTERS=32767 

 后面的数值自己计算, 方法如下:

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。

继续关注中..............

-----------------------------------------------------

第二天晚上(2005-01-18) netstat -m一切正常了,感觉,数据如下:

$ netstat -m
639/2880/131072 mbufs in use (current/peak/max):
        552 mbufs allocated to data
        87 mbufs allocated to packet headers
547/2754/32768 mbuf clusters in use (current/peak/max)
6228 Kbytes allocated to network (6% of mb_map in use)
0 requests for memory denied
0 requests for memory delayed
0 calls to protocol drain routines

估计是昨晚有人恶意攻击了,只能再看一段时间了,因为现在也不知道能做些什么,水平不够,呵:(

-----------------------------------------------------

发生那天晚上(2005-01-17)  显示器上不停出现如下字符:

All mbuf clusters exhausted , Please see tuning(7)

All mbuf clusters exhausted , Please see tuning(7)

All mbuf clusters exhausted , Please see tuning(7)

用google搜了一下,然后改动了/etc/defaults/loader.conf的kern.ipc.nmbclusters=""选项,目录数字加到32768,继续关注中.....

-------------------------------------------------------------------

在/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.

----------------------------------------------------------------------

man 7 tuning
看看有很多参数可以改
mbuf你改kern.ipc.nmbclusters

----------------------------------------------------------------------

转载于:https://www.cnblogs.com/funpower/archive/2005/07/09/189195.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值