Major problems with upgrade to >256 open files

James L. McGill (fishbowl@netcomi.com)
Thu, 17 Oct 1996 19:36:29 -0500 (CDT)


Hello.

First of all, thanks to everyone who helped me into this mess :-)
It's been going fairly ok, but I have had some real problems.

My plight:

I want to run a server, Apache httpd, with as many virtual
subdomains as possible.

I have increased the number of IP aliases in NET_ALIAS_MAX_SLOT
(linux/net_alias.h) (I do not think this is really part of the
problem).

I have increased FD_SETSIZE, NR_OPEN, OPEN_MAX, and NR_TASKS
with the following patch.. (at end)
I have then rebuilt the tcpip system from slackware source.
I have also built libc-5.3.12 to include these patched headers.

It seems to work for a while but I have started getting ugly GP faults
and the servers have been flatly locking up at seemingly random times
for no apparent reason. I build this on linux-2.0.22.

Without getting into grubbier details at this moment,
I would like to find out if anyone else besides me has
ever successfully increased these limits (number of open
files, number of open inodes, number of process table entries).

If these limits can't be raised without bad side effects,
I'm going to be forced to give up linux for my servers.
If I have to do -that- distasteful thing, what platform
will work? (Don't go there... just try to steer me to
correcting this.) It worked until I put a load on it.

I fear that I've missed something important. I would be
very much comforted to find out that I'm not the only
one who's tried this. I would welcome ANY advice.

______o/__[schnipp]_________________ This patch is -R, sorry.
O\
diff -r -u linux/include/asm-i386/resource.h linux-2.0-stock/include/asm-i386/resource.h
--- linux/include/asm-i386/resource.h Tue Sep 24 20:51:33 1996
+++ linux-2.0-stock/include/asm-i386/resource.h Fri Aug 23 07:29:01 1996
@@ -20,12 +20,6 @@

#ifdef __KERNEL__

-#if NR_OPEN > 256
-#define INIT_NR_OPEN 256
-#else
-#define INIT_NR_OPEN NR_OPEN
-#endif
-
#define INIT_RLIMITS \
{ \
{ LONG_MAX, LONG_MAX }, \
diff -r -u linux/include/linux/fs.h linux-2.0-stock/include/linux/fs.h
--- linux/include/linux/fs.h Wed Sep 25 01:50:04 1996
+++ linux-2.0-stock/include/linux/fs.h Fri Sep 13 05:07:08 1996
@@ -29,7 +29,7 @@

/* Fixed constants first: */
#undef NR_OPEN
-#define NR_OPEN 4096
+#define NR_OPEN 256

#define NR_SUPER 64
#define BLOCK_SIZE 1024
@@ -38,8 +38,8 @@
/* And dynamically-tunable limits and defaults: */
extern int max_inodes, nr_inodes;
extern int max_files, nr_files;
-#define NR_INODE 16384 /* this should be bigger than NR_FILE */
-#define NR_FILE 4096 /* this can well be larger on a larger system */
+#define NR_INODE 3072 /* this should be bigger than NR_FILE */
+#define NR_FILE 1024 /* this can well be larger on a larger system */

#define MAY_EXEC 1
#define MAY_WRITE 2
diff -r -u linux/include/linux/limits.h linux-2.0-stock/include/linux/limits.h
--- linux/include/linux/limits.h Wed Sep 25 01:46:48 1996
+++ linux-2.0-stock/include/linux/limits.h Wed Jul 17 07:10:03 1996
@@ -1,12 +1,12 @@
#ifndef _LINUX_LIMITS_H
#define _LINUX_LIMITS_H

-#define NR_OPEN 4096
+#define NR_OPEN 256

-#define NGROUPS_MAX 64 /* supplemental group IDs are available */
+#define NGROUPS_MAX 32 /* supplemental group IDs are available */
#define ARG_MAX 131072 /* # bytes of args + environ for exec() */
#define CHILD_MAX 999 /* no limit :-) */
-#define OPEN_MAX 4096 /* # open files a process may have */
+#define OPEN_MAX 256 /* # open files a process may have */
#define LINK_MAX 127 /* # links a file may have */
#define MAX_CANON 255 /* size of the canonical input queue */
#define MAX_INPUT 255 /* size of the type-ahead buffer */
diff -r -u linux/include/linux/net_alias.h linux-2.0-stock/include/linux/net_alias.h
--- linux/include/linux/net_alias.h Wed Sep 25 01:51:22 1996
+++ linux-2.0-stock/include/linux/net_alias.h Fri Sep 13 05:09:20 1996
@@ -25,7 +25,7 @@
* max. alias slot number allowed
*/

-#define NET_ALIAS_MAX_SLOT 4096
+#define NET_ALIAS_MAX_SLOT 256

struct net_alias;
struct net_alias_info;
diff -r -u linux/include/linux/posix_types.h linux-2.0-stock/include/linux/posix_types.h
--- linux/include/linux/posix_types.h Wed Sep 25 01:47:14 1996
+++ linux-2.0-stock/include/linux/posix_types.h Sun Aug 4 06:37:29 1996
@@ -30,7 +30,7 @@
#define __NFDBITS (8 * sizeof(unsigned long))

#undef __FD_SETSIZE
-#define __FD_SETSIZE 4096
+#define __FD_SETSIZE 1024

#undef __FDSET_LONGS
#define __FDSET_LONGS (__FD_SETSIZE/__NFDBITS)
diff -r -u linux/include/linux/tasks.h linux-2.0-stock/include/linux/tasks.h
--- linux/include/linux/tasks.h Wed Sep 25 01:35:08 1996
+++ linux-2.0-stock/include/linux/tasks.h Mon Oct 30 02:00:21 1995
@@ -11,7 +11,7 @@
#define NR_CPUS 1
#endif

-#define NR_TASKS 2048
+#define NR_TASKS 512

#define MAX_TASKS_PER_USER (NR_TASKS/2)
#define MIN_TASKS_LEFT_FOR_ROOT 4
Only in linux: list
--- /usr/include/gnu/types.h Wed Sep 25 01:47:42 1996
+++ /usr/include/gnu/types.h.orig Mon Mar 13 23:20:20 1995
@@ -112,7 +112,7 @@
#else /* __linux__ */

/* Number of descriptors that can fit in an `fd_set'. */
-#define __FD_SETSIZE 4096
+#define __FD_SETSIZE 256

/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
#define __NFDBITS (sizeof(unsigned long int) * 8)

------------------------+----------------------------------------------
James L. McGill | NETCOM Interactive
Programmer / Analyst | Dallas, Texas
<fishbowl@netcom.com> | -=[ http://www.conservatory.com/~fishbowl ]=-
------------------------+----------------------------------------------
"Deliver yesterday, code today, think tomorrow."