CentOS + PHP: Processes limited with shell_exec

Viewed 55

I have a httpd process running (just apache2), with PHP. In index.php I have the following code in the file:

echo shell_exec("sudo -u apache python3 /root/folder/script.py 2>&1");

Which should execute a a program (which its doing nicely). The program takes ~40 seconds to return something, so it takes a bit. Ive created another python program which is multithreaded. Which makes a request 400 times on the same time to the url, which should start 400 processes.

When I run the command top -c, I see that the CPU is only at 9% while that should be higher. I tried the next command, ps xa | grep apache | wc -l. That returns 101 processes, I've done the command multiple times and its always at 101.

Before I did the command ps xa | grep apache | wc -l, I first made a mistake and tried ps xa | grep apache2 | wc -l, I don't run apache2, but that still gave me the numer 1. So my theory is that 101 - 1 = 100. Which is a too beautiful number.

So this should be some type of maximum / limit / cap. Where can I configure this?

Thanks for your time

===== EDIT =====

I think its queue'ing the requests, while when I login into the server and run the python script manually, the script just normally works without any slow downs etc.

0 Answers
Related