SUMMARY: maximum number of open files in Tru64 v5.1a

From: Reed, Judith (jreed@navisite.com)
Date: Wed Sep 20 2006 - 08:05:57 EDT


I asked about the maximum number of files a process can open, since
performance tuning docs indicate that 4096 is the max you can set with
open_max_hard. I got a number of responses, thanks to all who replied.

It seems that this is indeed the highest you can set in
/etc/sysconfigtab.
You can, however, open up to 65536 files by a single process under
program control - it just can't be set as a system-wide limit by the
admin.

Whitney Latta pointed to the "setsysinfo(2)" man page, specifically the
section covering SSI_FD_NEWMAX options.

James Sainsbury tried writing a wrapper to transfer the higher limit to
the wrapper program, and found that the forked subprocess did inherit
the higher limit.

Jean-marc Vincent pointed out the "sysconfig -Q" option, which shows the
max_val for a parameter, useful option to know.

# sysconfig -Q proc open_max_hard
proc:
open_max_hard - type=INT op=CQ min_val=0 max_val=4096

Armin Ollig pointed to the man page for "sys_attrs_proc", check out the
reference for "open_max_hard" in there - it says the maximum value for
"open_max_hard" is 65,536! That is either incredibly misleading, or
false, or I'm still missing something. We tried raising the value for
this param (and "open_max_soft") above 4096 and rebooting, but you still
couldn't raise the process limit in any normal way (ie ulimit) above
4096.

Scott passed along a piece of code which demonstrates raising the limit.

------------------------------------------------------------------
  #include <sys/resource.h>
  #include <sys/sysinfo.h>
  #include <sys/param.h>
  
  main()
  {
      struct rlimit rlimit;
  
      /* increase the fd limit */
      rlimit.rlim_cur = rlimit.rlim_max = NEW_OPEN_MAX_SYSTEM;
      if (setsysinfo(SSI_FD_NEWMAX, NULL, 0, NULL, 1)
      || setrlimit(RLIMIT_NOFILE, &rlimit)) {
          perror("failed to increase fd limit");
          exit(1);
      }
      printf ("getdtablesize = %d\n", getdtablesize());
  }
------------------------------------------------------------------
Thanks very much to everyone who replied!

Judith Reed



This archive was generated by hypermail 2.1.7 : Sat Apr 12 2008 - 10:50:32 EDT