歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Unix知識 >> 關於Unix

FreeBSD之All mbuf clusters exhausted問題


/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。
另外,在/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.
傳說改這個也是有效的。
Copyright © Linux教程網 All Rights Reserved