PROCESS PROPERTIES
LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=, LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=, LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=, LimitRTTIME=
Note that most process resource limits configured with these options are per-process, and processes may fork in order to acquire a new set of resources that are accounted independently of the original process, and may thus escape limits set. Also note that LimitRSS= is not implemented on Linux, and setting it has no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5) over these per-process limits, as they apply to services as a whole, may be altered dynamically at runtime, and are generally more expressive. For example, MemoryMax= is a more powerful (and working) replacement for LimitRSS=.
Note that LimitNPROC= will limit the number of processes from one (real) UID and not the number of processes started (forked) by the service. Therefore the limit is cumulative for all processes running under the same UID. Please also note that the LimitNPROC= will not be enforced if the service is running as root (and not dropping privileges). Due to these limitations, TasksMax= (see systemd.resource-control(5)) is typically a better choice than LimitNPROC=.
Resource limits not configured explicitly for a unit default to the value configured in the various DefaultLimitCPU=, DefaultLimitFSIZE=, … options available in systemd-system.conf(5), and – if not configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise the limits above those set for the user manager itself when it was first invoked, as the user’s service manager generally lacks the privileges to do so. In user context these configuration options are hence only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as configured for the user. To raise the user’s limits further, the available configuration mechanisms differ between operating systems, but typically require privileges. In most cases it is possible to configure higher per-user resource limits via PAM or by setting limits on the system service encapsulating the user’s service manager, i.e. the user’s instance of user@.service. After making such changes, make sure to restart the user’s service manager.
Table 1. Resource limit directives, their equivalent ulimit shell commands and the unit used
| Directive | ulimit equivalent | Unit | Notes |
| LimitCPU= | ulimit -t | Seconds | – |
| LimitFSIZE= | ulimit -f | Bytes | – |
| LimitDATA= | ulimit -d | Bytes | Don’t use. This limits the allowed address range, not memory use! Defaults to unlimited and should not be lowered. To limit memory use, see MemoryMax= in systemd.resource-control(5). |
| LimitSTACK= | ulimit -s | Bytes | – |
| LimitCORE= | ulimit -c | Bytes | – |
| LimitRSS= | ulimit -m | Bytes | Don’t use. No effect on Linux. |
| LimitNOFILE= | ulimit -n | Number of File Descriptors | Don’t use. Be careful when raising the soft limit above 1024, since select() cannot function with file descriptors above 1023 on Linux. Nowadays, the hard limit defaults to 524288, a very high value compared to historical defaults. Typically applications should increase their soft limit to the hard limit on their own, if they are OK with working with file descriptors above 1023, i.e. do not use select(). Note that file descriptors are nowadays accounted like any other form of memory, thus there should not be any need to lower the hard limit. Use MemoryMax= to control overall service memory use, including file descriptor memory. |
| LimitAS= | ulimit -v | Bytes | Don’t use. This limits the allowed address range, not memory use! Defaults to unlimited and should not be lowered. To limit memory use, see MemoryMax= in systemd.resource-control(5). |
| LimitNPROC= | ulimit -u | Number of Processes | This limit is enforced based on the number of processes belonging to the user. Typically it’s better to track processes per service, i.e. use TasksMax=, see systemd.resource-control(5). |
| LimitMEMLOCK= | ulimit -l | Bytes | – |
| LimitLOCKS= | ulimit -x | Number of Locks | – |
| LimitSIGPENDING= | ulimit -i | Number of Queued Signals | – |
| LimitMSGQUEUE= | ulimit -q | Bytes | – |
| LimitNICE= | ulimit -e | Nice Level | – |
| LimitRTPRIO= | ulimit -r | Realtime Priority | – |
| LimitRTTIME= | ulimit -R | Microseconds | – |