Wordpress website <200 visit per day consume 1.5gb ram constantly

SYSTEM INFORMATION
OS type and version: Centos 8.4.2105
Webmin version: 1.973
Virtualmin version: 6.16
VPS configuration: Digital Ocean droplet 2vcpu 4gb ram
PHP version: 7.4 using FPM

Hi, I have 6 light wordpress websites in a single account. 5 of them is actually an ecommerce website, but not using woocommerce and having very minimal layout modification and function calls using foodpress theme. This is very light compared to woocommerce.

Ram usage from smem -uk -s rss command is constantly above 1G for this account, and peaked on 1.9G on RSS and 1.5G on swap.

I also have a website on other virtualmin server with <100 visit per day using woocommerce, but with some wp-rocket and redis. It also used about 1.5G rss and swap.

Both VPS sometimes have memory exhausted, resulting in returning error 500 timed out on browser and sometimes Bind DNS killed.

I never have memory problem on cpanel with much higher traffic woocommerce websites, can somebody give me a pointer on what to look?

edit: add VPS details

Use php-fpm and tweak it to release memory quicker than usual.

I tried to apply modifications as suggested by link you provided.

By default, virtualmin is using mpm_event, but using FPM dynamic instead of ondemand as suggested on by tecmint.
I believe 10s timeout to kill fpm children is enough to reduce RAM usage.

After restarting FPM & Apache, RAM usage reduced to 700M compared to 100-200M of other user running single wordpress which I believe it is fair, however after few hours, it climbed back to 1.1G.

I have never liked WP Rocket. To me it caused far more problems than it cured.

Also, are you using Cloudflare?

I would ditch WP Rocket and get Hummingbird.

If you’re using not using Cloudflare, you may want to consider it. It works very well with Hummingbird and after some time of caching your site you’ll see the memory usage drop a good bit.

Check out this page and see if it may be something that might interest you.

1 Like

Yes.

The user I mentioned in question is not using any caching plugin, it only use cloudflare as proxy and cache. Thus makes wp plugins irrelevant.

Edit: I included the other VPS with wp rocket as comparison. So I believe it is not because of caching plugin.

You may be right. But:

If you don’t coordinate the Rocket caching with the Cloudflare caching you wind up with conflicts on the cache purge, so you wind up holding on to a bunch of files you shouldn’t be holding on to which…

wait for it…

increases your memory usage exponentially.

The user I mentioned in question is not using any caching plugin, it only use cloudflare as proxy and cache. Thus makes wp plugins irrelevant.

This is likely why you’re having problems. Caching in WP is relevant even if you’re using a CDN. My favored combination is WP Super Cache combined with Autoptimize. Also remove any unused plugins and themes.

Continuing the discussion from Wordpress website <200 visit per day consume 1.5gb ram constantly:

It looks like community here is focused to caching plugin that I mention for comparison. The main question is about an account, that does not use any 3rd party caching features from plugins or CDN.

My main concern is, it is unusual for an account with less than 200 visit daily combined from all 6 wordpress sites, exhausting resources on 2vcpu and 4gb ram VPS as quoted below:

What should I look for reducing this issue?

For starters, you could run top and check which processes consume most of your resources. Also, I would switch from Apache to Nginx if I were you. I have seen dramatic improvement in performance (RAM as well as CPU) when I switched to Nginx but that’s more or less an ime/imo though.

And with regards to the top suggestion above:

  • If you see a bunch of PHP processes consuming excessive RAM, then you would need to tweak your PHP configuration accordingly. Depending on your sites’ traffic as well as on other factors like your sites’ theme structure and plugin settings, I would recommend using a mix of dynamic, static and ondemand. I would also recommend setting up and configuring OPCache in your PHP config.
  • If you see MySQL/MariaDB consuming excessive RAM, then you would need to tweak your database configuration accordingly.
  • If you see some other process(es) consuming excessive RAM, post a snippet of the results here and maybe someone could help with narrowing the cause down.

@technicalw above as all experts here said, check your php code for old or shit code practices, same for js and if you use jquery same for that… once you are sure your code is running clean and within standards enable gzip if you did not already… then focus on databases… select, repair, optimize - read outputs it will tell you what is bad and what was done… if some plugin, better remove it asap and replace by your own code or another plugin.

I hope it did helped.