kernel process limitation workaround
These are some instructions that I used to increase the allowed number of
open files on one of my systems. It looks like this is a common fault in
busy machines. YMMV!
Note that some application might need to be recompiled if they access more
than 256 files.
---------- Forwarded message ----------
Date: Sat, 7 Mar 1998 00:34:04 -0800 (PST)
From: George Bonser <grep@shorelink.com>
To: grep@oriole.sbay.org
Subject: [ST] Mercury -- and why its so overloaded. (fwd)
On Tue, 3 Mar 1998, George Bonser wrote:
>
> Aveek, I am having some load-related problems on Corsica that I have been
> troubleshooting while I have her here at home. One thing that I am noticing
> seems to be a limitation of the Linux kernel. I seem to have processes
> dying with "file table overflow" as if there are too many open files.
>
> Have you noticed anything along these lines?
Yes George, and I fixed that, among other things :)
Here's what I found, thanks to Bernhard for pointing me in the right
direction. Enjoy! #include std-disclaimer
Date: Fri, 16 Aug 1996 16:14:47 -0400 (EDT)
From: David Schwartz <davids@wiznet.net>
Cc: linux-kernel@vger.rutgers.edu
Subject: Re: Number of FD's available to a process
The following might be of use to you and others attempting the same:
In Linux 2.0.x, you can raise the 256 file descriptors per process
limit to 1024 with the following changes:
WARNING: Please be very careful. If you don't know how to compile
and install a Linux kernel and don't know the proper precautions to
take
first, DON'T DO THIS.
In /usr/include/linux/fs.h change NR_OPEN from 256 to 1024.
In /usr/include/linux/limits.h, change NR_OPEN to 1024 and OPEN_MAX
to 1024.
In /usr/include/linux/posix_types.h, change __FD_SETSIZE to 1024.
(Later versions of Linux may already have this change made.)
In /usr/include/gnu/types.h, change __FD_SETSIZE to 1024.
*The below needs to be modified for Debian, it can be any time after the
/proc filesystem is mounted, I think.
In /etc/rc.d/rc.M add the following two lines:
/bin/echo "2048" > /proc/sys/kernel/file-max
/bin/echo "4096" > /proc/sys/kernel/inode-max
In /usr/src/linux type: 'make clean; make dep; make zlilo' (Or
whatever rebuilts the kernel completely on your system.)
Reboot with the new kernel and, from bash, do a 'ulimit -a' and make
sure 'open files' reads 1024. You may also compile the test program
included
below and run it. It should read 1024 for both limits.
Recompile any applications that need to select on more than 256
files. (Applications that don't try to use more than 256 files at a
time
will not notice any changes and do not need to be recompiled.)
Once you get your real applications running using all those file
descriptors, you should check '/proc/sys/kernel/file-nr' and
'/proc/sys/kernel/inode-nr' a few times to make sure you have enough
room.
If necessary, raise the values in '/etc/rc.d/rc.M'.
David Schwartz
davids@wiznet.net
-------------
#include <sys/types.h>
#include <fcntl.h>
#include <stdio.h>
void main(void)
{
int k=3;
while((dup(0))!=-1) k++;
printf("Opens=%d Fdsize=%d\n",k,sizeof(fd_set)*8);
}
--
E-mail the word "unsubscribe" to debian-user-request@lists.debian.org
TO UNSUBSCRIBE FROM THIS MAILING LIST. Trouble? E-mail to listmaster@debian.org .
Reply to: