How to reduce Virtual Server Prossesses and Memory Use?

5 posts / 0 new
Last post
#1 Fri, 08/30/2019 - 20:09
adamjedgar

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) https://drive.google.com/open?id=1xyvi14HJNnElXt_e9rplhPZonVZHoGgd

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. https://drive.google.com/file/d/1LuoMd8UpwrBZRqUQBdD7EzlJLqicqabO/view?usp=sharing

  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?

Fri, 08/30/2019 - 20:26
andreychek

Howdy,

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:

https://www.virtualmin.com/documentation/system/low-memory

Fri, 08/30/2019 - 20:28
adamjedgar

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) https://drive.google.com/file/d/1982snfuq_bigaepGGyctNMU0X8vIv09w/view?usp=sharing

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%)

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Sat, 08/31/2019 - 03:48
styria

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

Sun, 09/01/2019 - 03:08
adamjedgar

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) https://drive.google.com/file/d/116e2MoEhYhGWISZZYG7hhnn2dSP_kQvw/view?usp=sharing

Also, for the following URL and guide

https://www.virtualmin.com/documentation/system/low-memory

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

AJECreative is the home of $5 webhosting, $15/month VPS servers (1cpu,1gb RAM, 25GB storage)
Centos7, Debian9, or Ubuntu18LTS
Available Control Panels = Centos-Webpanel, Cyberpanel, or Virtualmin

https://ajecreative.com.au

Topic locked