🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #40661

Re: INN2.2: Too many open files

#40661
From: Jens-S. Voeckler
Date: Thu, 07 Oct 1999 00:00
112 lines
6468 bytes
On 4 Oct 1999, Russ Allbery wrote:

]jan <jan@online.be> writes:
]
]> extra information on all kinda "solaris tunig"can be found at:
]> http://www.rvs.uni-hannover.de/people/voeckler/tune/EN/tune.html
]
]This page has one of the common old recommendations about soft file
]descriptor limits:
]
]| With respect to the standard IO library, you should not raise the soft
]| limit above 256. Stdio can only use <= 256 FDs.
]
]While the second statement is true, at lesat with Solaris 2.6 (Solaris 7
]changed a bunch of this stuff), the first statement isn't necessarily.

The quote should continue with the complete paragraph:

]| You can either use AT&T's sfio library, or wait for Solaris 7
]| which is said to have fixed this weakness. RPC prior to 2.6 may
]| break, if more than 1024 FDs are available to it.

RPC might even break, if there are more than 256 FDs available to it... 

As to Solaris 7, if you do nothing about your code, even in 64 bit mode
the limit on stdio is still 256. You need to use the "-xarch=v9" option in
order to compile for 64 bit mode, and thus for more than 256 stdio FDs.
SUN says in its answer books on 64 bit environments:

)In the 64-bit environment, the stdio facility has been extended to allow
)more than 256 streams to be open simultaneously. The 32-bit stdio
)facility continues to have a 256 streams limit.

But we were talking about the soft limit. Any software needing more can
use the [gs]etrlimit calls to increase their soft limit, or log an error,
if the hard limit was set too low.

Historically, I recommeded more than 256 FDs as soft limit. You would not
believe, how many people (me included) just scan the tuning tips and use
the suggested values without bothering to think about what they are doing.
And if you raised your FD soft limit above 256 (up to and including S2.6),
and you use the SUN workshop compilers, do not complain to me (or SUN)
that the license manager fails to connect via RPC, thus you license is
not found and thus your compiler does not work... That is basically the
major reason for suggesting 256 as system wide default soft limit (not
hard limit, mind you). As server software runs with a different user id,
one can always set a different limit there on a per user basis.

]This will only be a problem if your stdio-using program opens more than
]256 files or if you're using fdopen() to turn file descriptors over 256
]into stdio FILEs.

That is correct.

]My experience is that most applications that use lots of open files either
]use strictly raw file descriptors or strictly stdio and that the mixing
]doesn't end up being much of a problem.  

All three are correct.

]Furthermore, note that if you've got a file descriptor valued over 256,
]under normal circumstances (ie, in the absence of intentionally
]relocating file descriptors, which is something INN does a bit of) your
]program would have failed *anyway* with a limit of 256.  Failing by
]hitting a file descriptor limit may fail more cleanly than failing by
]hitting stdio errors, but I don't think that's enough to warrant the
]recommendation against doing this.
]
]For dedicated INN server systems, I still recommend increasing the soft
]limit to 1024 and then forgetting about it.  INN uses stdio as little as
]possible, and basically not at all in the processes that have to open lots
]of files.

I would recommed to include code into INN that does FD checks like squid
during start-up, e.g. have a look about the amount of FDs available (hard
limit), and increase the soft limit as necessary, or complain, if the hard
limit is too low. After all, soft limits are *meant* to be changed, if too
low. It is about a screen page of code, and gives many users much less
trouble than providing for them a HOWTO fix the limits for a variety of
systems and releases.

Though getrlimit() and setrlimit() are not part of POSIX (according to
Stevens APUE), both SVR4 and 4.3+BSD provide them. The only catch is to
look out for RLIMIT_NOFILE (SVR4) versus RLIMIT_OFILE (BSD) - nothing a
small #if #define #endif couldn't catch... But then, if it is not strictly
POSIX, it might not run on NT ;-) But then, the sysinfo(_SC_OPEN_MAX) will
return the soft limit, and it is POSIX conformant.

]This page also recommends increasing the hard limit over 1024, which is
]something that you absolutely do not want to do for INN as it may break
]select().  (The text does point out the problems with this.)  The text
]there seems mostly aimed at tuning Squid systems.

Squid is what my experiences are best with, but the tuning tips are
provided having dedicated servers in mind, (almost) regardless of the type
of service provided, though, yes, the bias is on web services and
especially on WAN connections. Admittedly, there is no magic silver bullet
for all servers and services, e.g. I got a whole set of different tunings
for lab equipment and heavy service benchmarking.

BTW, recoding from select() to poll() is not very difficult, and it is
said to be even a bit faster on Solaris systems as added sugar besides
having more than 1024 FDs available.

Le deagh dhùrachd,
Dipl.-Ing. Jens-S. Vöckler (voeckler@rvs.uni-hannover.de)
Institute for Computer Networks and Distributed Systems
University of Hanover, Germany; +49 511 762 4726


Technical Details
Message-ID: <Pine.SGI.4.05.9910071318390.1017-100000@challenger-lane>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
References: <7t9j09$5tu$1@oak.fernuni-hagen.de> <ylln9ji95m.fsf@windlord.stanford.edu> <37F8AA6D.7F31CCE2@online.be> <ylg0zrgqpy.fsf@windlord.stanford.edu>

Show Full Headers
Complete Article Headers
Message-ID: <Pine.SGI.4.05.9910071318390.1017-100000@challenger-lane>
Subject: Re: INN2.2: Too many open files
Date: Thu, 07 Oct 1999 00:00:00 +0000
From: "Jens-S. Voeckler" <voeckler@rvs.uni-hannover.de>
References: <7t9j09$5tu$1@oak.fernuni-hagen.de> <ylln9ji95m.fsf@windlord.stanford.edu> <37F8AA6D.7F31CCE2@online.be> <ylg0zrgqpy.fsf@windlord.stanford.edu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 533878627
Content-Transfer-Encoding: QUOTED-PRINTABLE
To: Russ Allbery <rra@stanford.edu>
X-Sender: voeckler@challenger-lane
Content-Type: TEXT/PLAIN; charset=ISO-8859-1
X-Complaints-To: abuse@newsserver.rrzn.uni-hannover.de
X-Trace: newsserver.rrzn.uni-hannover.de 939300110 29024 130.75.215.246 (7 Oct 1999 12:41:50 GMT)
Organization: RRZN - Newsserver Test
Mime-Version: 1.0
NNTP-Posting-Date: 7 Oct 1999 12:41:50 GMT
Newsgroups: news.software.nntp