[MUD-Dev] How to support 1000+ simultaneous connections, and some philosophy.

J C Lawrence claw at varesearch.com
Fri Mar 12 10:33:22 New Zealand Daylight Time 1999

On Fri, 12 Mar 1999 06:18:39 +0200 (EET) 
Petri Virkkula <pvirkkul at iki.fi> wrote:

>>>>>> "Ben" == Ben Greear <greear at cyberhighway.net> writes:

> 	That depends on your operating system. Linux seems to have
> per process hard limit 256...

This was sort of true in 2.0.x kernels, is not true in 2.2.x
kernels, and is based on a widely spread misunderstanding of the
actual import of the OPEN_MAX #define in linux/include/limits.h.

> ... in Solaris we have currently 1024 (which is the default
> value), used to have 16384 (that can easily achieved by editing
> /etc/system and rebooting) but Sun's license manager didn't like
> that value. I have an impression (but I might be wrong) that
> atleast in Solaris there is no per system hard limit at all, only
> per process limit. 

Under HP-UX (at least as of 10.20, and 10.30, which are the ones I
worked on at HP) it is a compile time option for the kernel.  Just
go into `sam`, set the option, hit build, and reboot.  Don't know
about Solaris.

> I wouldn't be suprised if Linux had a fixed per system hard limit.

This varies across kernel versions.  If you are running a 2.0.x
kernel you will need to apply Alan Cox's large file descriptor patch
2.2.x kernels include this patch (and possibly more) and largely
make file descriptor limits a runtime configurable option via
getrlimit(2) and the /proc filesystem.

Quoting from linux/Documentation/proc.txt in the linux-2.2.3 source
distribution (taken from kernel.org):


file-nr and file-max
   The kernel allocates file handles dynamically, but as yet
   doesn't free them again.

   The value in file-max denotes the maximum number of file handles
   that the Linux kernel will allocate. When you get a lot of error
   messages about running out of file handles, you might want to raise
   this limit. The default value is 4096. To change it, just write the
   new number into the file:

   # cat /proc/sys/fs/file-max
   # echo 8192 > /proc/sys/fs/file-max
   # cat /proc/sys/fs/file-max

   This method of revision is useful for all customizable parameters
   of the kernel - simply echo the new value to the corresponding
   The three values in file-nr denote the number of allocated file
   handles, the number of used file handles, and the maximum number of
   file handles. When the allocated file handles come close to the
   maximum, but the number of actually used ones is far behind, you've
   encountered a peak in your usage of file handles and you don't need
   to increase the maximum.

   However, there is still a per process limit of open files, which
   unfortunatly can't be changed that easily. It is set to 1024 by
   default. To change this you have to edit the files limits.h and
   fs.h in the directory /usr/src/linux/include/linux. Change the
   definition of NR_OPEN and recompile the kernel.


J C Lawrence                              Internet: claw at kanga.nu
---------(*)                        Internet: claw at varesearch.com
...Honorary Member of Clan McFud -- Teamer's Avenging Monolith...

MUD-Dev maillist  -  MUD-Dev at kanga.nu

More information about the MUD-Dev mailing list