squid Your cache is running out of filedescriptors

squid 3.0 访问网站一时好,一时卡主

检查 /var/log/squid/cache.log

出现:

 

WARRNING: Your cache is running out of filedescriptors

的原因是因为

squid 的

Maximum number of file descriptors过小,默认为:1024

/usr/local/squid/bin/squidclient -p 80 -h localhost mgr:info (进行查看)

 

解决方法:

修改系统的 

 

#ulimit -HSn 32768 (因为本次修改在系统重启后会失效,所以修改一下文件)

 

 

/etc/security/limits.conf

在最后添加:

* soft nofile 32768 (或65536)

* hard nofile 32768 (或65536)

 

这样系统重启后相关参数也会生效

 

现在重启 squid

#service squid restart

 

重启squid 后查看 

/usr/local/squid/bin/squidclient -p 80 -h localhost mgr:info

找到

File descriptor usage for squid:
        Maximum number of file descriptors:   16384
        Largest file desc currently in use:     95
        Number of file desc currently in use:   64
        Files queued for open:                   0
        Available number of file descriptors: 14936
        Reserved number of file descriptors:   100
        Store Disk files open:                   0

 

这样问题就解决了!

 

 

你可能感兴趣的:(script)