limit

LIMIT#

  • /etc/security/limits.conf - 全局配置
  • /etc/security/limits.d/ - 通常用于配置单个进程
# 其他进程的 limits
cat /proc/1/limits
# 修改其他线程
prlimit --pid $(pidof prometheus) --nofile=65535:65535
typeunitflagvalueflavor
core file sizeblocks-c0
data seg sizekbytes-dunlimited
file sizeblocks-funlimited
pending signals-i63510linux
max locked memorykbytes-l64
max memory sizekbytes-munlimited
open files-n1024
pipe size512 bytes-p8
POSIX message queuesbytes-q819200linux
real-time priority-r0linux
stack sizekbytes-s8192
cpu timeseconds-tunlimited
max user processes-u63510
virtual memorykbytes-vunlimited
file locks-xunlimitedlinux

/proc/1/limits

Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size 0 unlimited bytes
Max resident set unlimited unlimited bytes
Max processes 30464 30464 processes
Max open files 1024 4096 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 30464 30464 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us