I’ve got a wordpress website hosted on a vps running virtualmin, here the configuration:
Operating system CentOS Linux 7.7.1908
Webmin version 1.940
Memory: 3.6 GiB total
MySQL version 5.5.64
PHP versions 5.4.16, 7.0.27
Apache version 2.4.6
The database started crashing frequently and randomly 2 days ago (it crashed like one month ago too). There has been no modification or update in this time frame that could have started the crashes. It crashed 2 times yesterday at 13:30 14:25 and this morning at 00:55. Each time I restart the database but I need to find the source of these crashes so I can fix it.
This log just tells us MySQL (or Mariadb, more likely, as that’s the default on CentOS 7) went away.
You’ll want to look for the MySQL/Mariadb error log, which is probably in /var/lib/mysql/hostname.err
Where hostname is your system hostname. That may or may not have clues.
Mariadb (and MySQL) are generally extremely stable, so if it’s shutting down I tend to suspect it’s being killed rather than crashing, maybe by the OOM (out-of-memory) killer in the kernel. Check dmesg for indications that memory is being exhausted. Make sure you aren’t allocating more RAM than is reasonable for your various processes (in my.cnf and in your PHP configuration, in particular).
Thanks for your feedback, i followed the tutorial to configure virtualmin for a low memory config but everything has already been done. Could a WordPress plugin like wordfence (wich is known to be memory consuming) be the origin of the problem (even though it has been installed on the site for some time now without any issue) ?
Actually, that probably doesn’t tell us anything useful (I guess the Webmin PS output doesn’t show RES vs. Virtual memory usage…this is probably wildly over-representing memory usage of each of these process). Check top (you’ll need to login via ssh) instead…look at the RES field. That’s how much resident memory is in use for a given process.
But, it doesn’t matter what I think is “wrong”. Obviously you’re running out of memory. That’s not debatable. The question is what are you going to do about it. Your options are to shrink usage (MySQL could be shrunk by reducing its buffer/cache settings, at the expense of performance; if you’ve already gone through the “Virtualmin on Low Memory Systems” guide and followed those steps, you’ve already done pretty much everything I can tell you to do), increase memory, or add a swap file. All but adding memory will probably make performance worse.
Oh, one other thing, you could shutdown fail2ban. It’s kinda big, and not strictly mandatory. As long as you have very strong passwords and otherwise good security practices, you should be OK. You could also install something smaller, like sshguard (which is more limited, but very small).
I ran MySQL Tuner and have more infos on the running out of memory subject. You’re obviously right but the metrics that the tuner gave me seems ridiculously high making me question the relevancy to upgrade the vps. Here are the metrics
[–] Physical Memory : 3.6G
[–] Max MySQL memory : 153.5G
[–] Other process memory: 0B
[–] Total buffers: 704.0M global + 1.0G per thread (151 max threads)
[!!] Maximum reached memory usage: 36.1G (1001.18% of installed RAM)
[!!] Maximum possible memory usage: 153.5G (4256.23% of installed RAM)
[!!] Overall possible memory usage with other process exceeded memory
Variables to adjust:
*** MySQL’s maximum memory usage is dangerously high ***
*** Add RAM before increasing MySQL buffer variables ***
SET innodb_stats_on_metadata = OFF
query_cache_size (> 32M)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
innodb_log_file_size should be (=16M) if possible, so InnoDB total log files size equals to 25% of buffer pool size.
There’s obviously an over consumption of RAM by the database but it seems that it would happen even on an upgraded vps.
well - to be honest with you, have look what are you running at the first place - all those wp optimisation things does not need to be there, if your wp is clean and perfect code like mine - you should not have and single problem, however I can see you do have an problem - since you are running on centos plus you do some plugins which is not need it - please refer to centos and wp docs to use your wp install… virtualmin have nothing to do with wp - it only your own know-how…
virtualmin does servers not issues with wordpress nor wordpress plugins