The kernel says it can support up to 32768 process id at /proc/sys/kernel/pid_max
, but how many process can my server handle simultaneously without complaining about resources or hangs my server,
I know it depends on each process behaviors and resources need, but is there some kind of equation that has some parameters like Ram, cache, cpu cores …etc?
Edit:
My Server is hosted on Linode with following specifications:
RAM: 12 GB
CPU: Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz
cpu MHz : 2499.970
cache size : 4096 KB
Cores: 6 cores
My server has some old versions that run my application,
Apache 2.2
mysql 5.5
php 5.3
php5-fpm
Best Answer
There is a formula for calculating the maximum number of active PIDs or threads. Excerpt from
kernel/fork.c
:However, normally other limits will be hit first. If RAM and other resources last, then some cgroup limits will likely be first, where basically the limit is:
The number, 12288, is the same on both my older 3 gigabyte server and my newer 16 gigabyte server.
And I can test by trying to spin out more than the maximum number, resulting in a message in
/var/log/kern.log
:And checking the number I had at the time:
top
said about 12479But after those processes ended, I got:
top
said about 205, and note: 12479 - 205 + 15 = 12289