max no of open files with perl on solaris
Julian Field
jkf at ecs.soton.ac.uk
Mon Dec 23 21:05:26 GMT 2002
This has been discussed quite recently.
Take a quick look at
http://www.phonax.com/tuning/filehandle-tuning.shtml
and you will find all the answers.
Quoting Ron Campbell <rc at ITSS.NERC.AC.UK>:
> The following little perl script opens as many files as possible
> and then tells you how many it managed to open -
>
>
> $ cat of.pl
> #!/usr/bin/perl
>
> $count = 0 ;
> while ( $count >= 0 ) {
>
> $count++ ;
> $FH = "FH" . "$count" ;
> open $$FH , "/dev/null" or last ;
> }
>
> print "\n $count File opens\n" ;
>
>
>
> Obviously, this is a rewrite of a C program which someone posted last
> week. Interesting thing is that, no matter what I try, I cant get
> more than 255 open files with perl on Solaris. I tried perl 5.6.1, 5.8
> Solaris 2.6, Solaris 9 - makes no difference.
>
> Linux is different - no problem opening 1000 files with the above script
> if you use ulimit -n 1000 first. Solaris allows up to 65536 in the
> "ulimit -n " command but it makes no difference to perl.
>
> I think the problem may be that perl uses "C standard IO" lib -
>
> #include <stdio.h>
>
> and this has a limit of 256 file descriptors ??
>
> Fix is clear - something like following in mailscanner.conf
>
>
> Max Unscanned Messages Per Scan = 10
> Max Unsafe Messages Per Scan = 10
>
>
> [Original values are 500 and 100].
>
>
> But it is nice to have an explanation of what is going on - at least I
> think it is !!
>
> I have checked by
>
> 1) stopping mailscanner
> 2) sending a couple of thousand messages ( so they end up in the
> mqueue.in directory. )
> 3) starting mailscanner and watching it work thru the backlog with no
> messages about "unable to open" files
>
>
> Cheers ... Ron Campbell
>
>
> --
> --------------------
> Ron Campbell Email: rc at itss.nerc.ac.uk Fax: 01491 692446
> IT Solutions & Services, NERC. Phone: 01491 692346
> Maclean Building, Crowmarsh Gifford, Wallingford, Oxon OX10 8BB
>
--
Jules
jkf at ecs.soton.ac.uk
mailscanner at ecs.soton.ac.uk
More information about the MailScanner
mailing list