Subject: Re: kernel tuning issues
To: None <netbsd-help@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: netbsd-help
Date: 06/10/2003 03:50:50
In article <1055216300.10539.24.camel@jupiter.acf.aquezada.com>,
Julian C. Dunn - Lists <lists@aquezada.com> wrote:

kern.maxfiles is what you want.

christos

>This evening I accidentally killed our webserver by adding another
>VirtualHost to it. Before Apache died, the kernel did emit, once, the
>message:
>
>Jun  9 21:59:10 neutrino /netbsd: proc: table is full - increase
>kern.maxproc or NPROC
>
>A quick "sysctl kern.maxproc" showed the value to be 532, corresponding
>to a maxusers setting of 32.
>
>Now, I know that maxusers is set way too low for this machine, and I'll
>have to fix it. However, even though I immediately tried to remove the
>vhost that pushed the system over the top, Apache continued to die. The
>only way I managed to bring Apache back up was to delete all the vhosts,
>start it, then put the vhosts back and "apachectl graceful" the thing.
>
>A "ktrace httpd" showed something like:
>
>...
>  1953 httpd    RET   open 210/0xd2
>  1953 httpd    CALL  break(0x842c000)
>  1953 httpd    RET   break 0
>  1953 httpd    CALL  pipe
>  1953 httpd    RET   pipe 211/0xd3
>  1953 httpd    CALL  fork
>  1953 httpd    RET   fork 2215/0x8a7
>  1953 httpd    CALL  pipe
>  1953 httpd    RET   pipe 213/0xd5
>  1953 httpd    CALL  fork
>  1953 httpd    RET   fork 2216/0x8a8
>  1953 httpd    CALL  pipe
>  1953 httpd    RET   pipe -1 errno 24 Too many open files
>  1953 httpd    CALL  exit(0x1)
>
>So then I did a "pstat -T" and we had something like:
>
>631/2000 files
>   4397 vnodes
>11M/2047M swap space
>
>All right, I thought, we're running out of vnodes, so I did "sysctl -w
>kern.maxvnodes=8802" (given that kern.maxvnodes is by default, 4401, in
>our scenario). This didn't seem to help Apache start by itself, either,
>without the hack described above (remove most vhosts, start apache, then
>put the vhosts back and -USR1 it)
>
>So now I'm unsure how to go about solving this problem. I have some
>notion that increasing maxusers will help, but why? I don't have much of
>an understanding about what role all of these kernel parameters play,
>and I'd like to tune the system intelligently instead of just shooting
>in the dark without learning anything. Can anyone offer any advice or an
>explanation of what I should do and why?
>
>The machine in question is a Pentium II/400 with 256MB of RAM and serves
>about 75 virtual hosts.
>
>- Julian
>
>-- 
>Julian C. Dunn <julian@dreaming.org>
>Director of Operations, The Dreaming Electronic Community Network, Inc.
>Support e-mail: support@dreaming.org
>WWW: http://www.dreaming.org/