这是在阅读另外一个产品的告警指导书时,无意中发现pid_max这个参数。
原来Linux内核对于进程的数量使用pid_max做控制。
做一些简单的试验,如下演示获取当前配置值的方法:
# cat /proc/sys/kernel/pid_max
32768
# sysctl -a|grep pid_max
kernel.pid_max = 32768
如下是sysctl命令的帮助。
# sysctl -h
Usage:
sysctl [options] [variable[=value] ...]
Options:
-a, --all display all variables
-A alias of -a
-X alias of -a
--deprecated include deprecated parameters to listing
-b, --binary print value without new line
-e, --ignore ignore unknown variables errors
-N, --names print variable names without values
-n, --values print only values of a variables
-p, --load[=] read values from file
-f alias of -p
--system read values from all system directories
-r, --pattern
select setting that match expression
-q, --quiet do not echo variable set
-w, --write enable writing a value to variable
-o does nothing
-x does nothing
-d alias of -h
-h, --help display this help and exit
-V, --version output version information and exit
For more details see sysctl(8).
参考资料
若非注明,均为原创,欢迎转载,转载请注明来源:Linux下进程数量的限制pid_max