How to reduce Virtual Server Prossesses and Memory Use?

Hi guys,
I have been looking at my stats over the last few weeks and i notice that particularly in this month, the memory usage is just continuing to climb and never stabilising unless the system is restarted (see image link)

In addition to the above, I notice that some of the domains (Virtual Servers) on my webhosting server are displaying multiple process ids for the php=fpm master process, however, even when websites are not being accessed, these process ids are not being terminated (see image link attached). However, on the last Virtual Server, the master process is being terminated as soon as the website is no longer being accessed in my broswer. None of these websites have much traffic btw.

  1. You will notice that in the first 3 groups of processes (wordpress websites - “creative”, “removals”, “habitat”) there are multiples, however the last has just one process (these are all wordpress websites).

How can i reduce the number of processes for these 3 in order to be same as the consulting website? (just 1 process)

  1. Also, the last website process (wordpress website - “consulting”), automatically terminates when i am no longer browsing the site, however, none of the others do this.

although in the image link is showing “consulting” as running, it does terminate automatically and only ever runs a single process!

How can i get the other Virtual Servers to automatically terminate processes like the Wordpress website “Consulting” one does?


It’s normal for PHP processes not to exit even if the site isn’t being accessed – that’s how they cache your site. If that’s not what you want, if you want them to exit immediately after running, you may want to consider switching to CGI rather than FPM.

As far as why your one site doesn’t display that same behavior, it’s possible it’s already using a different PHP Execution Mode.

Although your system may not be low-memory, there’s some thoughts on how to maximize available memory here in the “Virtualmin on low memory” document, that may have some thoughts that you can use:

aha…i have realised one of the problems is that i forgot to make some changes to virtualmin>Services>php-fpm configuration>Edit Configuration Manually

pm.max_children = 75 (default was 9999)

pm = ondemand (the default was dynamic)

I have left the “pm.max_spare_servers = 5” for now

notice now all the virtual server processes have automatically terminated (no longer visible)

i would like to address the postfix number of processes as well. I dont want that many if possible.

After changing the above my server memeory usage in dashboard>system information, immediately dropped by half (from 46% to 21%)

Unfortunately, ondemand also means slower website reaction times in my test.

I am not sure about how much slower websites are, however, i havent noticed any difference when browsing them. My assumption is that the reason for this is that most of the sites I mentioned above are wordpress sites…which access the mysql database each time a page loads anyway. So that being the case, website caching from the server isnt going to do so much i suspect…hence my not noticing much difference on mine.

What i can say, since i made the above-mentioned changes take a look at my webserver statistics…its perfectly stable now hovering at 21%. I am delighted with this result as prior to the change the memory usage just continued a steady climb until the system had exhausted all of its memory and restarted (or i restarted it manually before that could happen)

Also, for the following URL and guide

shouldnt we be editing /etc/apache2/mods-available/ (instead of /etc/apache2/apache2.conf)?