

Next we need to estimate how much RAM is being consumed by other processes. Looking at these figures we're seeing roughly 150000KB, or 0.15GB, given to each php-fpm7.3 process. This will print something similar to: S UID PID PPID C PRI NI RSS SZ WCHAN TTY TIME CMD Run the following command: # ps -ylC php-fpm7.3 -sort:rss Our server was beginning to get busy just as the working day starts - which is expected - and so clearly we need to don our overalls and open our server toolbox. WARNING: [pool spawning 8 children, there are 0 idle, and 9 total children You might see the following: WARNING: server reached pm.max_children setting (10), consider raising it Run the following command (note that we're currently running PHP 7.3 and the '7.3' in 'php7.3' in the examples below may need to be replaced with the version number of PHP you're running): # sudo nano /var/log/php 7. Leave your server running for a couple of days and check the PHP-FPM log. PHP-FPM maintains pools of worker threads to achieve more efficient processing. This service then processes the request and hands it back to Apache to serve. php file it passes this on to the (separate) process manager service. How does this work? When Apache receives a request for a. What is PHP-FPM?įor our more popular PHP-based sites we employ PHP-FPM - the FastCGI Process Manager - to serve PHP files. But for now let's take a look at php-fpm. It is possible to tune mod_php to ensure Apache doesn't attempt to consume more memory than you have available and we'll study this is a subsequent post. As your site becomes popular (and again we're thinking here of both wanted and unwanted visits) you'll see memory use climb. On the one hand this results in efficient serving of 'PHP heavy' websites (WordPress and Moodle are good examples) but, on the other, each spawned process can consume a good deal of memory. Each spawned process is 'self contained', meaning it contains its own copy of the PHP interpreter. Essentially Apache will spawn ('pre-fork') a new process for each connection starting with, and keeping, a pool of processes available for any page being served. This in itself is not necessarily a bad thing. By default, Apache serves PHP pages using mod_php.
