MariaDB usage continued to climb until it crashed

Host

Operating system Ubuntu Linux 22.04.2
Webmin version 2.013
Usermin version 1.861
Virtualmin version 7.5
Using --LEMP (Nginx webserver)

Processor information AMD EPYC Processor (with IBPB), 4 cores
Running processes 229 CPU load averages 0.27 (1 min) 0.25 (5 mins) 0.20 (15 mins)
Real memory 2.44 GiB used / 1.11 GiB cached / 3.83 GiB total
Virtual memory 20.37 MiB used / 1023.99 MiB total

50-server.cnf (set by install script for large 4G system)

character-set-server = utf8mb4
collation-server = utf8mb4_general_ci
innodb_file_per_table = 1
max_allowed_packet = 64M
query_cache_size = 4M
thread_cache_size = 512
myisam_sort_buffer_size = 256M
read_rnd_buffer_size = 1M
read_buffer_size = 512K
sort_buffer_size = 4M
table_open_cache = 6000
key_buffer_size = 256M

This is a new server that I just set up a week or two ago. Everything works well, but for the first week, the ram usage would slowly climb after a boot (several hours to most of a day), until MariaDB crashed. I added swap, and it hasn’t crashed since, but this morning, both real and virtual memory were mostly used up. I rebooted, and it went back to low levels, and slowly started climbing again.

Previous installations had Mysql. This is the first using MariaDB. There are no logs under /var/log/mysql, and I haven’t found any other location for MariaDB logs.

It is possible that I am running too many virtual servers for this install, but I only added a few more from previous installs, and none are that busy. I don’t understand why memory usage would simply slowly climb.

Can anyone point me in the right direction for performance tuning MariaDB as it is set up on a Virtualmin box?

Here is what I get with htop:

Here is what I have turned on for reatures and plugins:

OK. This is interesting. 2 systems in a couple of days with the same problem and on the same OS?

Different OS and db ‘flavor’ but:

The 20%/70% assumes you have at least 4GB of RAM. If you have a tiny antique, or a tiny VM, then those percentages are too high.

I think that htop output is a bit scarying.
what do you see in virtualmin like I get

restart your php-fpm server (the one the web sites use)does that drop your mem usage alot?

@palomnik,

What services are running on your VPS?

Ex.

  • mail
  • antivirus
  • antispam
  • websites
  • MySQL/MariaDB
  • DNS
  • etc

Also if websites which is assumed, what are they powered by (ex. WordPress, custom code, etc).

Generally speaking you can accomplish lots with 4GB of RAM that you have, however various factors can affect performance and required resources.

I restarted PHP-FPM and the memory usage dropped dramatically! Then slowly started climbing again.

You can see what I have turned on above. It is much less than I had turned on on the old server, where I did not have the memory issue.

After I restarted PHP-FPM, the memory use drastically decreased! then gradually recommenced upward.

@palomnik,

So you DO NOT send or receive email on this server?

I have only one mail account that connects to a Wordpress plugin to allow a non-technical staff person to post via email. It is not used to send mail and it only gets about one message per month.

My previous server had several active email accounts, but no memory issues.

Which plugin?

If it’s Wordpress Automatic, get rid of it. Bury it and then bury the shovel you buried it with. Plugins like that are notorious for being exploited and absolutely killing your system and site.

I had the same issue last week on Debian 11 - everything up to date on the box.

MySQL was crashing twice a day. In sys log there was mention of MySQL update failing … This seemed to be happening a couple of times a day.

I had 4GB ram on this box - couple of sites only send mail from contact form.

I upgraded to 8GB and everything has been stable since …

Thought this was worth sharing …

Kind regards
Brad

I upgraded to 8G of Ram. The server does not crash, but I still have the issue of ram usage slowly climbing. Now it hangs around 60%, and still uses swap quite a bit. MariaDB uses the most, while the PHP-FPM processes for different sites are next.

It might be OK, but I used to run these sites in 4G servers and have lots of ram to spare. Is it possible that MariaDB consumes more than MySQL?

One other thing: I selected out Clam antivirus (not used), but I discovered that some clam processes were running until I turned them off.

I don’t feel like I have got to the bottom of the ram usage yet.

For reference, and I run clamscan but not many active sites at the moment:
root@main:~# free -h total used free shared buff/cache available Mem: 15Gi 5.5Gi 1.1Gi 257Mi 9.0Gi 9.5Gi Swap: 4.0Gi 1.0Gi 3.0Gi

But if you want to explore detailed usage, you might try the Mariadb folks.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.