Re: How to increat [sic.] max open files?

Dean Gaudet (dgaudet@arctic.org)
Fri, 3 Jan 1997 00:48:02 -0800 (PST)


For some reason I didn't see the original message complaining about Apache
so I don't know who sent it... so forgive this going back to the kernel
list.

Anyhow, it's wrong to say "Apache wants to open 4 log files per server".
It's right to say "my configuration asks Apache to open 4 log files per
server". I'm guessing you've got RefererLog, and CookieLog defined on
each vhost. Try using mod_log_config and combining them into a single log
with the access log saving you two fds per child (at the expense of losing
CLF).

Alternately define a single log for the entire server and split it
regularly into logs for each vhost.

If that doesn't satisfy you, send me mail. There are even more
alternative solutions.

Dean

On Thu, 2 Jan 1997, Andi Kleen wrote:

> In message <Pine.LNX.3.95.970102105737.11740D-100000@fotd.netcomi.com>you write
> :
> [cc'd to linux-kernel again
>
> >> You get the lockups because the kernel select() (fs/select.c) routine
> >> puts 6 copies of fd_set on the kernel stack. The kernel stack per
> >> process on i386 is limited to 4K. With NR_OPEN of 4096, one fd_set is
> >> 512bytes. With 6*512bytes you have already overflowed the kernel stack
> >> when a process uses select().
> >
> >I do not understand the relationship of NR_OPEN to the rest of these
> >issues. Your message is the closest thing to documentation I have seen.
>
> NR_OPEN is the number of fds a process can open.
>
> >
> >> The proper solution would be that
> >> sys_select() allocates the fd_set copies dynamically with kmalloc().
> >> Someone has to hack this in.
> >
> >But no one is going to, and I do not have the knowledge to attempt it.
> I did a first try, but it locked up my machine and did other harm and
> I don't have enough time currently to debug it.
>
> >
> >> BTW It's better to use NR_OPEN of 1024 (like Digital Unix or Solaris do).
> >> With bigger values the FD_SET(), FD_ZERO() etc. macros in glibc won't work.
> >
> >I don't understand "why", because I don't know what NR_OPEN does. Would this
> >limit me to having only 1024 files per process open?
> Yes.
> >
> >The application is virtual HTTP's (Apache). Apache wants to open 4 log files
> >per server. We want to put a 512 servers on a machine. Except for the
> >FD limit, we can. We have since decided to only put 300 servers (as an altern
> >ative
> >to using FreeBSD instead of Linux!), but since we host over 4,000 domains
> >we really and truly need a fix for this. A real, proven solution would be
> >worth $$$ to our organization.
>
> When you want to pay $$, I'm sure you can find someone on the kernel
> mailing list to rework sys_select() and add proper support for NR_OPEN>256
> to the kernel. That's how free software works :)
> For NR_OPEN>1024 a patch to libc will be needed too I think.
>
> -Andi
>