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?
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.
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.
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…
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.
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:
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.
That has to be some theme or plugin you’re using doing that. It just has to be.
Wordpress has pretty much dropped the ball entirely on maintaining standards on themes and plugins. There are a lot of “free” themes out there that will rack up so many mysql requests it can shut you down on some service providers. I’m talking into the 10’s of thousands of requests per hour.
Utility plugins are the same. Some of the free caching plugins are simply horrible.
By comparison, my main site is just a forum these days; no Wordpress at all. (It runs Xenforo) I get between 250 - 350 unique visitors a day. My memory usage on that site never gets above 150 to 200 MB at any given time.
You need to start looking at which apps are racking up the most requests. I’m willing to bet you’ll find it’s either a theme you’re using or some sort of caching program or other utility plugin.
Since above you’ve posted just a top processes using certain percentage of memory. On the other hand you can have 200 processes running and using just a bit of memory each and they just might be php processes.
In addition to that it might be good idea to post here your servers .conf file, just as someone above mentioned it, you might want to tweak it to get better results, probably change 9999 setting to something much lower or make tweaks to use ondemand instead of dynamic. Since you are probably high on php processes.
Conf files are probably located here /etc/php-fpm.d/ or for your PHP version, they should be here /etc/opt/remi/php74/php-fpm.d/ but it completely depends on your PHP setup. This is just a wild guess.
FWIW, Virtualmin.com gets (a lot) more visitors than that, running WordPress and WooCommerce, using basically a stock Virtualmin PHP-FPM configuration, and isn’t using an inordinate amount of resources (virtualmin 5 0 329.9M 399.8M 837.3M to compare apples to apples with the same smem command).
So, I think I want to blame one of your WordPress plugins, as others have done. I didn’t do any tuning, beyond giving MariaDB a bit more cache and buffer space.
I tend to want to suggest you turn on slow query logging in your database, and see if you can spot what’s working a lot and holding connections open for a long time. Turning off less critical WP plugins is also a good idea to help narrow down the problem.
High memory usage can be a symptom or a cause, and it’s hard to know which it is without figuring out exactly what’s chewing it up.
You may be reading things wrong, here. Many processes (e.g. PHP or Apache) will be sharing much of their memory used via shared libraries. You can’t just add them up.
threesix looks fine, to me, I think. That’s about what you’d expect for a WordPress+WooCommerce+other modules installation.
root is maybe large. But, that includes MySQL, which can be quite large depending on your configuration.
for 200visits per day, why use 50 max children? a value of 5 or 10 should be enough… eg config.
pm = ondemand
pm.max_children = 5
pm.process_idle_timeout = 10s
pm.max_requests = 100
other options :
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 35
are not used when pm is ondemand, you can remove those.
from a brief reading of case, you might have issues with your themes/plugins as well, you might need to look at mysql, apache logs for errors…
i would also dump cloudflare, never understood why people use those “net bullies”. they slow down your site, 3rd parties should be avoided unless absolutely necessary…
This is a shared server. One virtual server have 200 visits per day. is 5 max_children is for each virtual server?
Free plan from Cloudflare helped to increase GPS and GT Metrix score for me. Do you have better alternative?
Doesn’t MySQL have it’s own user? Why is it using root account too?
I cannot find big memory usage from htop interface for root account. How can I found out what process is eating that much memory?