Ulimit: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
(Created page with "=Internal= * Linux =Overview= Provides control over the resources available to the shell and to processes started by it, on systems that allow such contr...")
 
No edit summary
Line 10: Line 10:


These limits can be set up permanently in /etc/security/limits.conf specifically for the account we want:
These limits can be set up permanently in /etc/security/limits.conf specifically for the account we want:
{{{
 
<pre>
jbossusr soft nofile 16384
jbossusr soft nofile 16384
jbossusr hard nofile 16384
jbossusr hard nofile 16384
}}}
</pre>


!!!Options
=Options=


* __-a__    All current limits are reported
* __-a__    All current limits are reported
Line 38: Line 39:




!!!To Get a Hard Limit for the Value
=To Get a Hard Limit for the Value=


{{{
<pre>


     ulimit -Hn
     ulimit -Hn


}}}
</pre>


!!!To Set A Value
!!!To Set A Value

Revision as of 00:55, 11 June 2016

Internal

Overview

Provides control over the resources available to the shell and to processes started by it, on systems that allow such control. The -H and -S options specify that the hard or soft limit is set for the given resource. A hard limit cannot be increased by a non-root user once it is set; a soft limit may be increased up to the value of the hard limit. If neither -H nor -S is specified, both the soft and hard limits are set. The value of limit can be a number in the unit specified for the resource or one of the special values hard, soft, or unlimited, which stand for the current hard limit, the current soft limit, and no limit, respectively. If limit is omitted, the current value of the soft limit of the resource is printed, unless the -H option is given. When more than one resource is specified, the limit name and unit are printed before the value.

The hard limit is the upper bound of the property, set by root. The soft limit is the per-user limit that can be adjusted at run time (using ulimit) up to the hard limit.

These limits can be set up permanently in /etc/security/limits.conf specifically for the account we want:

jbossusr soft nofile 16384
jbossusr hard nofile 16384

Options

  • __-a__ All current limits are reported
  • __-b__ The maximum socket buffer size
  • __-c__ The maximum size of core files created
  • __-d__ The maximum size of a process' data segment
  • __-e__ The maximum scheduling priority ("nice")
  • __-f__ The maximum size of files written by the shell and its children
  • __-i__ The maximum number of pending signals
  • __-l__ The maximum size that may be locked into memory
  • __-m__ The maximum resident set size (many systems do not honor this limit)
  • __-n__ The maximum number of open file descriptors (most systems do not allow this value to be set)
  • __-p__ The pipe size in 512-byte blocks (this may not be set)
  • __-q__ The maximum number of bytes in POSIX message queues
  • __-r__ The maximum real-time scheduling priority
  • __-s__ The maximum stack size
  • __-t__ The maximum amount of cpu time in seconds
  • __-u__ The maximum number of processes available to a single user
  • __-v__ The maximum amount of virtual memory available to the shell
  • __-x__ The maximum number of file locks
  • __-T__ The maximum number of threads


To Get a Hard Limit for the Value


     ulimit -Hn

!!!To Set A Value

!!.bashrc

Edit the corresponding .bashrc and add the following (for example, for file descriptors) but make sure it's under the hard limit set by root:

{{{

   ulimit -n 2048

}}}

!!/etc/security/limits.conf


{{{ jbossusr soft nofile 16384 jbossusr hard nofile 16384 }}}


This change does not require a reboot - only that all processes belonging to the user are killed and restarted, so they can use the new value.

Note that configuration files in /etc/security/limits.d directory, which are read in alphabetical order, override the settings in this file in case the domain is the same or more specific.

A good practice would be to modify those files first.

For example, the file that controls noproc and overrides /etc/security/limits.conf is /etc/security/limits.d/90-nproc.conf

{{{

  • soft nproc 1024

root soft nproc unlimited

}}}

__Referenced by:__\\ [{INSERT com.ecyrd.jspwiki.plugin.ReferringPagesPlugin WHERE max=20, maxwidth=50}]