Re: [squid-users] FD_SETSIZE and max open filedescriptors

From: Joe Cooper <joe@dont-contact.us>
Date: Thu, 03 Jan 2002 20:07:59 -0600

I'm not sure if anyone else replied to this (been kind of skimming my
mail today)...

There are other ways to address this problem...one of them is to alter
__FD_SETSIZE in /usr/include/bits/types.h to your preferred value (30000
is a bit unnecessarily high...I use 8192 or 16384, even on the biggest
commodity hardware in existence, and never get near the limit).

Chris McDonough wrote:

> Hi folks,
>
> I'm using Squid 2.4-STABLE3 on Linux 2.4.X, and it appears that the only
> way I can convince Squid to start with more than 1024 file descriptors
> (even if bash's ulimit -n reports, for example, 30000 at compilation
> time and runtime -- I'm dead certain that the OS and the shell limits
> are set high enough) is to bruce-force set the number in main.c like so:
>
> *** main.c Tue Dec 25 07:38:51 2001
> --- main-new.c Wed Jan 2 21:26:41 2002
> ***************
> *** 575,580 ****
> --- 575,581 ----
> debug_log = stderr;
> - if (FD_SETSIZE < Squid_MaxFD)
> - Squid_MaxFD = FD_SETSIZE;
> + Squid_MaxFD = 30000;
>
> #if defined(_SQUID_MSWIN_) || defined(_SQUID_CYGWIN_)
> if ((WIN32_init_err = WIN32_Subsystem_Init()))
>
> Note that this diff is against CVS HEAD, but the results are the same
> with 2.4-STABLE3. This works fine, or at least appears to under very
> heavy load.
>
> I don't really want to do this to main.c (for distribution purposes), so
> I've tried instead to force the define of src/squid.h's
> CHANGE_FD_SETSIZE to 1 (despite the dire warning as regards Linux)
> before a compilation but it seems to have no effect. After compiled
> this way (and running in a shell that has 30000 max open fds) Squid
> still starts with 1024 FDs available according to cache.log. Note that
> I *do* see configure report the max number of open filedescriptors as
> 30000 (as opposed to the Linux default of 1024). It also reports
> FD_SETSIZE as 1024.
>
> Has anyone else encountered this problem?
>
> - C

-- 
Joe Cooper <joe@swelltech.com>
http://www.swelltech.com
Web Caching Appliances and Support
Received on Thu Jan 03 2002 - 19:06:43 MST

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:05:37 MST