Table of Contents
Setting ULimit on Red Hat
Most shells like Bash provide control over various resources like the maximum allowable number of open file descriptors or the maximum number of processes available to a user.
Working with Limits
To see all shell limits, run:
[sjoerd@redhatbox limits.d]$ ulimit -a core file size (blocks, -c) 0 data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 709150 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 1024 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) 10240 cpu time (seconds, -t) unlimited max user processes (-u) 1024 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
This will show the soft limits by default. You can see the hard limits like this:
[sjoerd@redhatbox limits.d]$ ulimit -Ha core file size (blocks, -c) unlimited data seg size (kbytes, -d) unlimited scheduling priority (-e) 0 file size (blocks, -f) unlimited pending signals (-i) 709150 max locked memory (kbytes, -l) 64 max memory size (kbytes, -m) unlimited open files (-n) 4096 pipe size (512 bytes, -p) 8 POSIX message queues (bytes, -q) 819200 real-time priority (-r) 0 stack size (kbytes, -s) unlimited cpu time (seconds, -t) unlimited max user processes (-u) 709150 virtual memory (kbytes, -v) unlimited file locks (-x) unlimited
The hard limit is the ceiling for the soft limit. The soft limit is what is actually enforced for a session or process. This allows the administrator (or user) to set the hard limit to the maximum usage they wish to allow. Other users and processes can then use the soft limit to self-limit their resource usage to even lower levels if they so desire.
In the command output you see between () options to view a specific limit:
[sjoerd@redhatbox limits.d]$ ulimit -n 1024 [sjoerd@redhatbox limits.d]$ ulimit -Sn 1024 [sjoerd@redhatbox limits.d]$ ulimit -Hn 4096
As you can see, these also show the soft limit by default.
Setting Limits
There are two ways to set the limits on Red Hat. You can set them in the limits.conf file (/etc/security/limits.conf
) or create separate files per user in the limits.d directory:
[sjoerd@redhatbox limits.d]$ pwd /etc/security/limits.d [sjoerd@redhatbox limits.d]$ ll total 8 -rw-r--r--. 1 root root 191 Oct 7 2013 90-nproc.conf -rw-r--r--. 1 root root 127 Sep 4 11:40 99-appuser-limits.conf [sjoerd@redhatbox limits.d]$ cat 99-appuser-limits.conf appuser soft nproc 50000 appuser hard nproc 709150 appuser soft nofile 10000 appuser hard nofile 10000
Resources
See here for more information regarding limits for oracle user: https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/5/html/Tuning_and_Optimizing_Red_Hat_Enterprise_Linux_for_Oracle_9i_and_10g_Databases/chap-Oracle_9i_and_10g_Tuning_Guide-Setting_Shell_Limits_for_the_Oracle_User.html
See Red Hat Enterprise Linux 6.5 Management Server to set these limits for an oracle user during installation through kickstart.