4 Replies Latest reply: Jan 19, 2010 9:25 AM by 807567 RSS

    ulimit parameters - Setting File Descriptor parameter

    807567
      Hi all,

      how can i know the maximum allowed number that i can use to set the maximum number of file descriptor in the /etc/system file.
      as i faced some problems while trying to set it to 999999999 so it seems that there some limitations on that number or it depends on the hardware or the solaris version.

      thanks in advance.
        • 1. Re: ulimit parameters - Setting File Descriptor parameter
          807567
          The following command will show you per process resource constraints including the current constraint as well as the maximum constraint:
          # plimit $$
          16386:  /bin/ksh
             resource              current         maximum
            time(seconds)         unlimited       unlimited
            file(blocks)          unlimited       unlimited
            data(kbytes)          unlimited       unlimited
            stack(kbytes)         8192            unlimited
            coredump(blocks)      unlimited       unlimited
            nofiles(descriptors)  256             65536
            vmemory(kbytes)       unlimited       unlimited
          Solaris defaults to 256 file descriptors which happens to be a function of the maximum value for an unsigned char (uchar_t). While the 65536 happens to be the maximum value of an unsigned 32-bit integer (uint32_t). I'm guessing these constraints are capped at these values for backwards compatibility reasons, but I don't really know for sure. Anyway, traditionally you would issue the following "ulimit -n 65536" as a function of user limits. However with Solaris 10, we now can set process limits using "plimit -n 65536 <pid>". For example:
          # plimit -n 65536 $$
          # plimit $$
          16386:  /bin/ksh
             resource              current         maximum
            time(seconds)         unlimited       unlimited
            file(blocks)          unlimited       unlimited
            data(kbytes)          unlimited       unlimited
            stack(kbytes)         8192            unlimited
            coredump(blocks)      unlimited       unlimited
            nofiles(descriptors)  65536           65536
            vmemory(kbytes)       unlimited       unlimited
          I'm not familiar with /etc/system modifications. I think editing /etc/system has been deprecated - use prctl instead. Nevertheless, I do know that for Solaris 10, the maximum per process limit for file descriptors is 65536. The next example shows what the system-wide constraints are. For file descriptors, this value is: 2.15G (2,150,000).
          # prctl $$
          process: 16386: /bin/ksh
          NAME    PRIVILEGE       VALUE    FLAG   ACTION                       RECIPIENT
          <...snip...>
          process.max-file-descriptor
                  basic             256       -   deny                             16386
                  privileged      65.5K       -   deny                                 -
                  system          2.15G     max   deny                                 -
          <...snip...>
          Good luck,
          Tracy S. Brown
          • 2. Re: ulimit parameters - Setting File Descriptor parameter
            807567
            thanks alot Tracy for your help and info.

            my question now is
            is it possible to increase this maximum value which is 65536 and if yes what is the maximum allowed number is it 2.15G ?
            • 3. Re: ulimit parameters - Setting File Descriptor parameter
              807567
              The 65,536 limit is for non-privileged (aka not root) users and processes (that is, processes that don't run with a privileged user id). Solaris 10 support what it calls "unlimited" as you've seen via plimit. The following command examples show the mechanics for setting a process to unlimited. I am interpreting the "unlimited" setting to be up to the system wide constraints (2.15G). But this may not be the case, the 2.15 system-wide max descriptors might be for non-privileged processes.

              You need to be root (or a project-based privileged account)
              [uid=0(root)@nickle] [tbrown]: plimit $$
              24921:  ksh
                 resource              current         maximum
                time(seconds)         unlimited       unlimited
                file(blocks)          unlimited       unlimited
                data(kbytes)          unlimited       unlimited
                stack(kbytes)         8192            unlimited
                coredump(blocks)      unlimited       unlimited
                nofiles(descriptors)  256             65536
                vmemory(kbytes)       unlimited       unlimited
              
              [uid=0(root)@nickle] [tbrown]: plimit -n unlimited $$
              [uid=0(root)@nickle] [tbrown]: plimit $$
              24921:  ksh
                 resource              current         maximum
                time(seconds)         unlimited       unlimited
                file(blocks)          unlimited       unlimited
                data(kbytes)          unlimited       unlimited
                stack(kbytes)         8192            unlimited
                coredump(blocks)      unlimited       unlimited
                nofiles(descriptors)  unlimited       unlimited
                vmemory(kbytes)       unlimited       unlimited
              Good luck,
              Tracy S. Brown.
              • 4. Re: ulimit parameters - Setting File Descriptor parameter
                807567
                hi all..!
                as I get to restart the operating system, these paramaters are not lost?

                thanks

                best regards.

                Max