CPU utilization

|| SYSTEM INFORMATION||
|----------------------|---------------------------|
| OS type and version | Ubuntu Linux 22.04.4 |
| Webmin version | 2.111 |
| Usermin version | 2.010 |
| Virtualmin version | 7.10.0 Pro |
| Theme version | 21.10 |
| Package updates | All installed packages are up to date |

I am confused by the CPU utilization displays. I am trying to track down the cause of high CPU utilization. So I am looking at running processes but the % utilization does not make sense to me. I understand that a high number indicates high utilization, however these numbers often total more than 100%. I first though perhaps that is a per core # since I have 16 cores that could be it but then I get information like this which makes no sense.

Screen utilization:

but the display for processor utilization is:

So what does the 107 % mean? That does not go along with a 0 % total utilization shown on the dashboard. I need to understand these #s if I am going to make sense of the problems that I am having.

Thanks.
Michael

Not sure but cpu utilisation may be computed from many factors, may be run htop and see what figures that gives. But high usage by the database server does indicate problems with the app that is using mysql … wordpress perhaps ?

I know what process is causing the high Mariadb utilization. It is my listserver program (dadamail). Because when I shut it down and restart Mariadb the utilization goes to 0.3%. Once I start it Mariadb utilization climbs starting at around 18 % and continuing until it gets to 300% or more which does clog my server. What concerns me is that the CPU utilization of Mariadb continues to climb with time and never goes down. I am pretty sure that I have a database error. I still want to know what these numbers mean since I do not understand how the software can say that Mariadb is utilizing 117 % of the CPU when the total CPU utilization is around zero.

Thanks.
Michael

I use dadamail too. Have been for over 20 years. Dadamail is not to be blamed. The behaviour you describe is typical. You would see the same thing even if Dadamail was not installed on your server.

Over 100% cpu utilisation can happen even on a single core server and yours is much beefier. This percentage is not how we think of percentages intuitively.

If you are a Virtualmin newbie and wish to have a quick 10 minute paid chat about this, you could do that in addition to interacting with the very helpful community via this forum.

See

I never see this at all, my mysql server only reaches about 48% when I stress test it from the code I have written so I would say this is not typical

I agree but would be very surprized at even that level.

I would be questioning the code behind Dadamail it looks like a codebase that has not kept up with the times (still employing depreciated/careless sql - select * without limit)

Stress testing involves taking the code to more than what is reasonably expected from the code I have written makes around 30 mysql statements per request to stress test I make about 100 simultaneous requests which amounts to 3000 mysql statements in one go, which in my case, is over and above the amount of requests the code should be doing, the design amount is about 90 simultaneous requests which when testing never exceeds about 10% but as you each code base is very different

Let me explain the problem, even though my question was about the meaning of the percentages of CPU utilization in the “running process” tab, not how to fix my database problem.

My server crashed. I did not have a database backup but had the files from the database directory. I am trying to restore things. Unfortunately, when I run this, my utilization goes very high and I am just trying to understand the tools that I have.

Prior to the crash, I do not remember Dadamail using the CPU resources that it is using now. I don’t know if I paid attention to the CPU utilization of Mariadb before the crash. I am also running Dadamail on a non-production server as well to test it. It is not sending a lot of email there, but Mariadb is running at 0.3%. Also, when I shut Dadamail off and restart things Mariabd cpu utilization is very low as well, less than 1 %. I also have Joomla websites on my server, but they can run without significantly impacting Mariadb.

Because of the crash, I believe my database files for Dadamail are corrupted. I don’t exactly know how. The tables in Dadamail are mainly MyISAM but there are some Innodb tables as well. I believe those are the ones that are corrupted. When I run the MariaDB tools it says the tables are ok. There does not appear to be good tools for fixing Innodb tables.

Thanks,
Michael

The Webmin server interface for Mariadb has a backup feature. I run it in addition to other ‘normal’ server backups.

Good point the OP may have virtualmin backups from which he could restore just the databases, if not he maybe in for the long haul. If nothing else restoring the databases, perhaps, will do no harm

Or hopefully set the db backup feature at some time in the past and forgot about it like I did? :wink:

I’ll say it again because it has to be said. (until everyone understands)

when you run any server (long before you ever think of running anything on the thing) write out a process for a “Disaster Recovery Plan” file it away (this must include Backups) and keep it updated!

You may be really lucky and never need it - but on that day you will be thankful of the time you saved.

back on topic (well sort of)…

MariaDB is pretty good with its logging so there should be something in there it the Innodb tables are at fault. (I spend hours yesterday resolving an issue with a poor design using an incorrect/invalid charset) - but I expect the error logs went with the lost backup.

It sounds like there is much more running on this box than just Dadamail (and if that was the cause I would have expected more global reporting of the CPU issue.)

I am afraid I am unable to answer your main question #:
which I believe was “Why is CPU being reported as 107%”

1 Like
  1. I agree, I should have been backing up my system.
  2. I am not implying that there is anything wrong with Dadamail. Because I did not backup my database there is a problem with my database tables. All my fault.

But after all is said and done, I would like things working again and I am concerned by the CPU utilization of MariaDB.

My Questions:

  1. I looked for my MariaDB error logs in /var/logs/mysql but there are no logs in this directory, it is empty. Is this the correct location?
  2. How do I turn the error log function on in Maria ?

Thanks.
Michael

Error Logging

Not to be a nuisance but I looked at the link you sent me which was not that helpful. It basically said the error logs were automatically created.

I looked further and found a command “log_error=/var/log/mysql/mariadb.err”
I tried adding this to the configuration file and MariaDB would not start and gave a meaningless error message that it was not the correct version for this command to work. I am running the most recent version of MariaDB. So I removed the command and MariaDB once again worked.

I looked all over my mysql structures for an error log–those in /var/log/mysql, /var/lib/mysql and /etc/mysql but could not find a readable file.

So then I looked at /var/log/syslog in the log viewer and searched for Maria and found some entries. Is this where I am supposed to look. I have looked at the documentation and I cannot find it written out clearly what I am supposed to do.

Wanting to see the MariaDB error logs cannot be a super unusual request and there should be simple instructions to do this.

Please help.

Thanks.

Michael

Find out where the logs are first?

root@main:/etc/mysql# grep -ir log
mariadb.conf.d/50-server.cnf:expire_logs_days        = 10
mariadb.conf.d/50-mysql-clients.cnf:[mysqlbinlog]
mariadb.conf.d/60-galera.cnf:#binlog_format            = row
mariadb.conf.d/60-galera.cnf:#innodb_flush_log_at_trx_commit = 0
mariadb.conf.d/50-mysqld_safe.cnf:# StandardOutput = syslog
mariadb.conf.d/50-mysqld_safe.cnf:# StandardError = syslog
mariadb.conf.d/50-mysqld_safe.cnf:# SyslogFacility = daemon
mariadb.conf.d/50-mysqld_safe.cnf:# SyslogLevel = err
mariadb.conf.d/50-mysqld_safe.cnf:# SyslogIdentifier = mysqld
mariadb.conf.d/50-mysqld_safe.cnf:skip_log_error
mariadb.conf.d/50-mysqld_safe.cnf:syslog

Many logs are in the journal on modern systems, which are viewable with journalctl, e.g. journalctl -u mariadb

Webmin’s System Logs Viewer can also read the journal, though the UI is a bit clunky currently, with limited query options, I end up using the command line for most journal reading just because of better querying capabilities…the next version has a ton of improvements for reading and quering the journal that Ilia has been working on.

4 Likes

Thanks. That is what I wanted. I appreciate it.
Michael

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