• Please be aware: Kaspersky Anti-Virus has been deprecated
    With the upgrade to Plesk Obsidian 18.0.64, "Kaspersky Anti-Virus for Servers" will be automatically removed from the servers it is installed on. We recommend that you migrate to Sophos Anti-Virus for Servers.
  • The Horde webmail has been deprecated. Its complete removal is scheduled for April 2025. For details and recommended actions, see the Feature and Deprecation Plan.

Issue Mysql memory Usage

agamelas

New Pleskian
Hi,

I'm getting high mysql usage and can't figure out why.
I noticed because I got a bad gateway and went to check it.
DB has no errors.

Can someone help get this problem solved?
made no changes to site and honestly I do not understand very much server wise... so... I really don't know what to do...

image refers to last year

please guide me....
 

Attachments

  • Captura de ecrã 2020-12-16, às 13.08.50.png
    Captura de ecrã 2020-12-16, às 13.08.50.png
    458.2 KB · Views: 20
Less than a Gigabyte, doesn't really feel "high" here. It all depends on what the database is doing and if it occupies that RAM permanently or if part of this is a cache that can be cleared if other processes need the RAM. Normal usage here would be somewhere between 2 GB and 6 GB of RAM.

Could you provide more details, e.g. what x-axis labels do we see on the chart? Is it weeks, days, hours, minutes? How does the usage develope over the course of several days?
 
hi thanks! the x axis is from 2019-12-16 to this day.
last month usage in next images
how can I check if part is cache? I am not using any cache plugin or nginx cache. can you please guide me through?
 

Attachments

  • Captura de ecrã 2020-12-16, às 16.41.50.png
    Captura de ecrã 2020-12-16, às 16.41.50.png
    209.5 KB · Views: 14
  • Captura de ecrã 2020-12-16, às 16.41.55.png
    Captura de ecrã 2020-12-16, às 16.41.55.png
    67.4 KB · Views: 15
Please have a look into /etc/my.cnf. You will normally find some ache settings there, e.g.
table_open_cache, sort_buffer_size, read_rnd_buffer_size, query_cache_size, query_cache_limit etc.

As long as the database does not block your system RAM so that other processes cannot get enough RAM anymore, it's probably alright as it is. If the scale is a whole year for your chart, you could simply restart the service once in a while, e.g. once every other month, to clear RAM usage.

If your OS support cgroups, you could also limit memory usage of the database service by a cgroup definition.
For example create /etc/systemd/system/mariadb.service.d/50-MemoryAccounting.conf with this content:
Code:
[Service]
MemoryAccounting=yes
and /etc/systemd/system/mariadb.service.d/50-MemoryLimit.conf with this content
Code:
[Service]
MemoryLimit=524288000
to limit the service's memory usage to 500 MB.
Restart the service after these changes for the changes to take effect. I am not sure though, whether it is smart to limit the database to only 500 MB RAM. It feels a bit low. I'd probably give it as much as it likes to have while it should not have any impact on other processes. From your initial chart I took 750 MB as your typical usage, so maybe give it 750 MB and limit it there and see what happens?
 
If the scale is a whole year for your chart, you could simply restart the service once in a while, e.g. once every other month, to clear RAM usage.
how can I restart the service?
also I saw this advice of checking my.cnf but I am not finding it... in etc folder there's nothing like that...
 
# service mariadb restart
or
# service mysql restart

You seem to have Debian or Ubuntu? In that case look for my.cnf in the /etc/mysql directory.
 
SO: ‪CentOS Linux 7.9.2009 (Core)‬

Inside my etc folder I just have what ou see in image. I am sorry for all this trouble.
 

Attachments

  • Captura de ecrã 2020-12-16, às 18.24.02.png
    Captura de ecrã 2020-12-16, às 18.24.02.png
    19.2 KB · Views: 9
Are you logged in with "root"? It seems that you are logged in with a system account into a subscription SSH shell, but not to the system SSH shell as root.
 
CentOS should look different and have lots of files and directories in /etc when logged in with root. I have no idea how your system can even run with only these two folders in /etc. Sorry, but have never seen that before. Maybe it's some kind of container you are in? Maybe you need to contact your provider about it?
 
Back
Top