6 Replies Latest reply: Mar 7, 2012 6:29 AM by Nandinho RSS

    make ulimit changes permanent

    Nandinho
      Hi

      Please can you help, I heve changed the ulimit settings for stack size and open files (ulimit -s <new value> and ulimit -n <new value>) but after the reboot the new settings vanished, and the old settings return.
      How can I make this settings to prevail after a reboot?

      regards
        • 1. Re: make ulimit changes permanent
          SteveS
          ulimit(1) will only change the values for that shell and it's child processes only. It will not change the values system wide and is not permanent.

          Also keep in mind that ulimit(1) shows the soft limits, not the hard limits so check the hard limits before you go tuning. If the hard limits are too small, then increase them. ie:
          $ ulimit -a
          core file size        (blocks, -c) unlimited
          data seg size         (kbytes, -d) unlimited
          file size             (blocks, -f) unlimited
          open files                    (-n) 1024
          pipe size          (512 bytes, -p) 10
          stack size            (kbytes, -s) 10240
          cpu time             (seconds, -t) unlimited
          max user processes            (-u) 1000
          virtual memory        (kbytes, -v) unlimited
          
          $ ulimit -Ha
          core file size        (blocks, -c) unlimited
          data seg size         (kbytes, -d) unlimited
          file size             (blocks, -f) unlimited
          open files                    (-n) 65536
          pipe size          (512 bytes, -p) 10
          stack size            (kbytes, -s) unlimited
          cpu time             (seconds, -t) unlimited
          max user processes            (-u) 1000
          virtual memory        (kbytes, -v) unlimited
          Should you need to increase these values you have two options.

          1) Add the relevant entries to /etc/system and reboot. This will make the values global for all processes
          2) Use projects(1) to define the values and then use those projects for the user(s) you will be running the processes as

          If you choose Option 1, refer to the Solaris Tunable's Guide - http://docs.oracle.com/cd/E19455-01/816-0607/6m735r5fi/index.html
          If you choose Option 2, refer to the Solaris Resource Controls Guide - http://docs.oracle.com/cd/E23824_01/html/821-1460/rmctrls-1.html. A list of available controls can be found here - http://docs.oracle.com/cd/E23824_01/html/821-1460/rmctrls-3.html#rmctrls-4

          You should go read "How To Set The Limit For The Maximum Number Of Open Files Per Process In Solaris 10 And Solaris 11 (Doc ID 1408563.1)" which discusses both approaches and provides examples.

          HTH
          Steve
          • 2. Re: make ulimit changes permanent
            Nandinho
            Hi

            I was asked by the application vendor to do the following:

            Please ask customer to set this parameters in the /etc/system

            set max_nprocs=65546
            set pidmax=100000
            set maxusers = 4096
            set maxuprc=30000
            set noexec_user_stack=1

            Also increase the stack size and open files in ulimit –a on both oracle and moneta home directory

            core file size (blocks, -c) unlimited
            data seg size (kbytes, -d) unlimited
            file size (blocks, -f) unlimited
            open files (-n) 256 ------------------ open files (-n) 4096
            pipe size (512 bytes, -p) 10
            stack size (kbytes, -s) 8192 ---------------- stack size (Kbytes, -s) 131072
            cpu time (seconds, -t) unlimited
            max user processes (-u) 29995
            virtual memory (kbytes, -v) unlimited

            This is what their email stated

            Regards
            • 3. Re: make ulimit changes permanent
              SteveS
              That's easy enough to accomplish. I gave you everything you need to implement those requirements in my previous post. Hint: lwp_default_stksize & rlim_fd_cur for Option 1 or process.max-file-descriptor & process.max-stack-size for Option 2.

              Projects are perhaps the better route to take due to their granularity assignment ability, ie: you can assign attributes to specific users rather than to the entire system. See projadd(1M) and projmod(1M) for examples. It's up to you and your customer to decide which route to take.
              • 4. Re: make ulimit changes permanent
                Nandinho
                Hi

                I did everything that is in your post regarding to stack size and open files, but the problem is after reboot, I still had the old values.
                Perhaps its because I did not insert the same in /etc/system. Correct me if I am wrong?

                what I did was :

                #ulimit -n 4096
                #ulimit -s 131072
                them do ulimit -n and ulimit -s and got the results that I wanted.

                them reboot

                try "ulimit -n", got value 256, and for "ulimit -s" got value 8196

                regards
                • 5. Re: make ulimit changes permanent
                  SteveS
                  Did you add the entries to /etc/system or create projects?

                  Note the very first line in my 1st response:

                  ulimit(1) will only change the values for that shell and it's child processes only. It will not change the values system wide and is not permanent.

                  You either need to add the relevant entries to /etc/system OR implement projects for the two users. You choose.

                  As you've chose the /etc/system route for many of your setting, add the following to /etc/system and reboot

                  --- /etc/system ---
                  set lwp_default_stksize=0x20000
                  set rlim_fd_cur=4096
                  --- end ---
                  • 6. Re: make ulimit changes permanent
                    Nandinho
                    Hi!

                    I will add those entries in /etc/system now, but unfortunately I cannot reboot now, due to company policy.
                    Thanks a lot for your help.


                    Do I have to put a space between the value and the = sign?
                    Regards

                    Edited by: Nandinho on Mar 7, 2012 1:29 PM