免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1720 | 回复: 8
打印 上一主题 下一主题

[proxy] squid遇到问题,急! [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-02-24 10:10 |只看该作者 |倒序浏览
在cache.log中出现
WARNING! Your cache is running out of filedescriptors
这个问题能否解决,是否需要重新编译squid?

Linux version 2.4.14
gcc version egcs-2.91.66 19990314/Linux (egcs-1.1.2 release)
Squid/2.3.STABLE4

论坛徽章:
0
2 [报告]
发表于 2005-02-24 12:46 |只看该作者

squid遇到问题,急!

摘自squid-cache.org,原文引用如下:
-------------------------------------------
Unless someone would launch some kind of denial of service  attack against your squid. The 2 lines are normally unrelated  to the out of file desc. problem.
Check access.log to see which kind of requests are being processed  by squid during the time of these error(s).

论坛徽章:
0
3 [报告]
发表于 2005-02-24 12:49 |只看该作者

squid遇到问题,急!

摘自http://163.20.137.4/proxy_messages.htm,原文引用如下:
-----------------------------------------------------------------------------
探討原因:Proxy Server 使用量過大,filedescriptors 超過系統核心的限制。

解決方式

方法一:更改 FreeBSD kernel 中 maxusers 數值,預設是 32,而 filedescriptors = 40 + 32 * maxusers ,修改完後要重新編譯核心。

方法二:使用 sysctl.conf 來修改 kern.maxfiles 及 kern.maxfilesperproc 的值,在 /etc 目錄下直接新增一 sysctl.conf 檔,內容如下:

kern.maxfiles = 數字

kern.maxfilesperproc  = 數字

此數字值,可在學校內 proxy server 下 sysctl -a | grep maxfile ,系統所回覆的訊息中參考加大其數字值。

註:以上兩種方式均引述北縣鶯歌國中王富永老師編寫之 proxy 建構管理-- 2001/11/26 版。

论坛徽章:
0
4 [报告]
发表于 2005-02-24 12:50 |只看该作者

squid遇到问题,急!

摘自redhat.com,原文引用如下:
--------------------------------------
It'd be neat to find out what exactly is eating the file descriptors. A couple things you could do;

1) make sure squid is eating them, and not anything else on that drive. It's a bad idea to share the partition where squid's cache lives, with anything else (emphasis on mail server)

2) format the squid partition (the cache is on a seperate partition, isn't it...?) to use a much smaller blocksize

3) if all else fails, this is a good article, which includes information about increasing file descriptors: http://m1.mny.co.za/help/readme.nsf/0/8a644fed4d7991f885256a07004a561c?OpenDocument

论坛徽章:
0
5 [报告]
发表于 2005-02-24 12:58 |只看该作者

squid遇到问题,急!

摘自www.unix.org.ua(http://www.unix.org.ua/squid/FAQ-10.html),原文引用如下:
---------------------------------------------

If you see the Too many open files error message, you are most likely running out of file descriptors. This may be due to running Squid on an operating system with a low filedescriptor limit. This limit is often configurable in the kernel or with other system tuning tools. There are two ways to run out of file descriptors: first, you can hit the per-process limit on file descriptors. Second, you can hit the system limit on total file descriptors for all processes.

For Linux, have a look at filehandle.patch.linux(http://www.linux.org.za/filehandle.patch.linux)by Michael O'Reilly

For Solaris, add the following to your /etc/system file to increase your maximum file descriptors per process:

        set rlim_fd_max = 4096
        set rlim_fd_cur = 1024

You should also #define SQUID_FD_SETSIZE in include/config.h to whatever you set rlim_fd_max to. Going beyond 4096 may break things in the kernel.

Solaris' select(2) only handles 1024 descriptors, so if you need more, edit srcMakefile/ and enable $(USE_POLL_OPT). Then recompile squid.

For FreeBSD (by Torsten Sturm <torsten.sturm@axis.de>:

1.How do I check my maximum filedescriptors?
Do sysctl -a and look for the value of kern.maxfilesperproc.

2.How do I increase them?
        sysctl -w kern.maxfiles=XXXX
        sysctl -w kern.maxfilesperproc=XXXX

Warning: You probably want maxfiles >; maxfilesperproc if you're going to be pushing the limit.
3.What is the upper limit?
I don't think there is a formal upper limit inside the kernel. All the data structures are dynamically allocated. In practice there might be unintended metaphenomena (kernel spending too much time searching tables, for example).


For most BSD-derived systems (SunOS, 4.4BSD, OpenBSD, FreeBSD, NetBSD, BSD/OS, 386BSD, Ultrix) you can also use the ``brute force'' method to increase these values in the kernel (requires a kernel rebuild):

1.How do I check my maximum filedescriptors?
Do pstat -T and look for the files value, typically expressed as the ratio of currentmaximum/.

2.How do I increase them the easy way?
One way is to increase the value of the maxusers variable in the kernel configuration file and build a new kernel. This method is quick and easy but also has the effect of increasing a wide variety of other variables that you may not need or want increased.

3.Is there a more precise method?
Another way is to find the param.c file in your kernel build area and change the arithmetic behind the relationship between maxusers and the maximum number of open files.

Here are a few examples which should lead you in the right direction:
1.SunOS
Change the value of nfile in usr/kvm/sys/conf.common/param.c/tt>; by altering this equation:

        int     nfile = 16 * (NPROC + 16 + MAXUSERS) / 10 + 64;

Where NPROC is defined by:
        #define NPROC (10 + 16 * MAXUSERS)


2.FreeBSD (from the 2.1.6 kernel)
Very similar to SunOS, edit /usr/src/sys/conf/param.c and alter the relationship between maxusers and the maxfiles and maxfilesperproc variables:

        int     maxfiles = NPROC*2;
        int     maxfilesperproc = NPROC*2;

Where NPROC is defined by: #define NPROC (20 + 16 * MAXUSERS) The per-process limit can also be adjusted directly in the kernel configuration file with the following directive: options OPEN_MAX=128

3.BSD/OS (from the 2.1 kernel)
Edit /usr/src/sys/conf/param.c and adjust the maxfiles math here:

        int     maxfiles = 3 * (NPROC + MAXUSERS) + 80;

Where NPROC is defined by: #define NPROC (20 + 16 * MAXUSERS) You should also set the OPEN_MAX value in your kernel configuration file to change the per-process limit.


NOTE: After you rebuild/reconfigure your kernel with more filedescriptors, you must then recompile Squid. Squid's configure script determines how many filedescriptors are available, so you must make sure the configure script runs again as well. For example:

    cd squid-1.1.x
        make realclean
        ./configure --prefix=/usr/local/squid
        make

论坛徽章:
0
6 [报告]
发表于 2005-02-24 17:56 |只看该作者

squid遇到问题,急!

看来需要重新编译squid了!

论坛徽章:
0
7 [报告]
发表于 2005-02-24 18:37 |只看该作者

squid遇到问题,急!

也不一定非要这样,找到出现问题原因,对症下药。

论坛徽章:
0
8 [报告]
发表于 2005-02-25 09:29 |只看该作者

squid遇到问题,急!

应该是squid打开得文件超过了系统本身filedescriptors的限制。看了一下squid的FAQ,是需要重新编译squid的。

论坛徽章:
0
9 [报告]
发表于 2005-02-25 18:12 |只看该作者

squid遇到问题,急!

也可以通过对系统的内核进行调整,达到这一目的。
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP