SQUID的最大文件描述符数量的设定 

一、系统设置

1、查看系统设置
 cat /proc/sys/fs/file-max
 ulimit -a
 
2、更改系统设置的方式
 第一种
  ulimit -HSn 65536
   重启后会失效 建议放到/etc/rc.local中
 第二种
  vi /etc/security/limits.conf
  增加或修改
   #*               soft    nproc   16384
   #*               hard    nproc   16384
   *               soft    nofile  65536
   *               hard    nofile  65536
    说明:* 代表针对所有用户
     noproc 是代表最大进程数
     nofile 是代表最大文件打开数

二、squid设置
 编译之前要确认一下最大文件描述符的大小
 可以直接运行以下命令后,再编译。
  ulimit -HSn 65536
 编译的时候加入参数
  squid2.6 –-with-max-fd=65535
  squid3.0 --with-filedescriptors=65535
 运行后查看 运行中的squid的 最大文件描述符
 1、
  head /var/log/squid/cache.log | grep "file descriptors"
  
 2、./squidclient -h 127.0.0.1 -p 80 mgr:info
  相关字段如下
   File descriptor usage for squid:
   Maximum number of file descriptors:   1024
   Largest file desc currently in use:    855
   Number of file desc currently in use:  821
   Files queued for open:                   0
   Available number of file descriptors:  203
   Reserved number of file descriptors:   100
   Store Disk files open:                  76
   IO loop method:                     epoll