sysctl kernel.pid_max
查看pid的最大数字,服务器上的配置时3w多,服务端小伙伴给一个服务开了2w的线程,这个机器就变成下面这样的
Welcome to Qiniu Cloud Elastic Compute Service ! -bash: fork: Cannot allocate memory -bash-4.2# -bash-4.2# -bash-4.2# -bash-4.2# ls -bash: fork: Cannot allocate memory -bash-4.2# sls -bash: fork: Cannot allocate memory -bash-4.2# ls -bash: fork: Cannot allocate memory
查看这个进程打开的线程数
ps -eLf |grep pid| wc -l
修改最大进程数
echo 100000 > /proc/sys/kernel/pid_max
永久生效
echo "kernel.pid_max=100000 " >> /etc/sysctl.conf
sysctl -p