squid版本:squid-2.6.STABLE20-1.el4
内核:2.6.9-5.ELsmp
系统:Red Hat Enterprise Linux AS release 4 (Nahant)
squid运行一段时间后客户端就失去响应,重启又能撑一会。
查看cache.log发现错误:WARNING! Your cache is running out of filedescriptors
原来是filedescriptors用完了,查了下网上有不少人遇到这样的问题,网上介绍的方法大致如下:
1.编辑/usr/include/bits/types.h 文件,改变__FD_SETSIZE 的值:
#define _ _FD_SETSIZE 8192
2.下一步,使用这个命令增加内核文件描述符的限制:
# echo 8192 >; /proc/sys/fs/file-max
3.最后,增加进程文件描述符的限制,在你即将编译squid
的同一个shell 里执行:
sh# ulimit -Hn 8192
而且说要重新编译内核和squid,但是我的系统没有第一个参数,另外两个的值也比上述的大,重启squid查看启动日志:
2010/04/20 10:34:02| With 1024 file descriptors available 怎么还是1024?????
重新看squid配置文件,发现以下一段:
# TAG: max_filedesc
# The maximum number of open file descriptors.
#
# WARNING: Changes of this value isn't respected by reconfigure
# command. This value should be changed only if there isn't
# any active squid process.
#
# NOTE: This option is only supported by system with poll()
# or epoll(). You can set this value by --with-maxfd during
# compilation on system whith uses select().
#
# The maximum value for max_filedesc is set by --with-maxfd during
# compilation.
#
#Default:
#max_filedesc 1024
原来就是它,修改成4096,重启squid,查看日志:
With 4096 file descriptors available
这下消停啦,都怪没怎么好好看过配置文件,费了大半天劲,哎。。。。。
阅读(1219) | 评论(0) | 转发(0) |