SHIFT

--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools


Sidebar

Sponsor:

Would you like to sponsor this site?
Or buy me a beer?:


Recently Changed Pages:

View All Pages
View All Q Pages


View All Tags


Sign up for Q to post comments.





WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.


Terms And Conditions for Q users


Pages with comments

PageDateDiscussionTags
2019/06/22 10:36 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments

redhatulimit

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

You could leave a comment if you were logged in.
redhatulimit.txt · Last modified: 2014/09/04 12:04 by sjoerd