I'm running PHP-FPM on my Debian servers. My question is about the memory usage. I can only set the memory_limit inside PHP, and that shouldn't be too low for some requests. I also can only set the number of processes in PHP-FPM and that, also, should not be too low since I'm running a lot of php requests.
In most cases, processes will only use around 2-20mb. The process limit is 512, so that's roughly 5-10GB of RAM. But since some php scripts can use a lot more memory, the maximum allowed memory is around 1TB (512 processes * 2048mb). And if something goes wrong, the Debian OOM Killer will just randomly kill processes.
Is there any way to limit the total memory usage for php-fpm? Like a hard limit where php-fpm won't spawn more processes because it's out of total RAM.