Insane MySQL CPU Usage

My server was working fine I made no changes to the configuration, and my WordPress setting was JUST writing articles. But suddenly from 2 days MySQL is behaving strange and it's CPU usage are going above 350%, Don't know what's causing this but I also experienced this same issue 3 months ago but It got fixed automatically, but now It's becoming a pain as my sites are going down after each hour or sometimes just minutes.
Found out it was a hotlinked image problem on some pages of Tutuapp, GB Whatsapp, Showbox APK, EMus4U and Panda Helper.
Tutuapp
Panda Helper
Emus4U
GB Whatsapp
Showbox apk
and the strange thing is just after enabling cloudflare protection the whole issue got solved.
It's a note for you if you are facing the same issue,,,Please use cloudflare and if you are hosting any APK file then either use block container or just upload the APK file on Mediafire like services.

Here's the MySQL Tuner LOG
curl -L http://mysqltuner.pl/ | perl
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = (unset),
LC_ALL = (unset),
LC_CTYPE = "UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
100 216k 100 216k 0 0 277k 0 --:--:-- --:--:-- --:--:-- 277k

MySQLTuner 1.7.14 - Major Hayden major@mhtx.net
Bug reports, feature requests, and downloads at http://mysqltuner.com/
Run with '--help' for additional options and output filtering

[--] Skipped version check for MySQLTuner script
[OK] Logged in using credentials from Debian maintenance account.
[OK] Currently running supported MySQL version 5.5.62-0ubuntu0.14.04.1-log
[OK] Operating on 64-bit architecture

-------- Log file Recommendations ------------------------------------------------------------------
[--] Log file: /var/log/mysql/error.log(58K)
[OK] Log file /var/log/mysql/error.log exists
[OK] Log file /var/log/mysql/error.log is readable.
[OK] Log file /var/log/mysql/error.log is not empty
[OK] Log file /var/log/mysql/error.log is smaller than 32 Mb
[!!] /var/log/mysql/error.log contains 5 warning(s).
[!!] /var/log/mysql/error.log contains 157 error(s).
[--] 5 start(s) detected in /var/log/mysql/error.log
[--] 1) 190104 16:59:28 [Note] /usr/sbin/mysqld: ready for connections.
[--] 2) 190104 16:53:21 [Note] /usr/sbin/mysqld: ready for connections.
[--] 3) 190104 10:36:06 [Note] /usr/sbin/mysqld: ready for connections.
[--] 4) 190104 10:00:01 [Note] /usr/sbin/mysqld: ready for connections.
[--] 5) 190104 9:49:31 [Note] /usr/sbin/mysqld: ready for connections.
[--] 5 shutdown(s) detected in /var/log/mysql/error.log
[--] 1) 190104 16:59:02 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 2) 190104 16:53:19 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 3) 190104 10:27:15 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 4) 190104 9:58:56 [Note] /usr/sbin/mysqld: Shutdown complete
[--] 5) 190104 9:41:14 [Note] /usr/sbin/mysqld: Shutdown complete

-------- Storage Engine Statistics -----------------------------------------------------------------
[--] Status: +ARCHIVE +BLACKHOLE +CSV -FEDERATED +InnoDB +MEMORY +MRG_MYISAM +MyISAM +PERFORMANCE_SCHEMA
[--] Data in MyISAM tables: 8.8M (Tables: 31)
[--] Data in InnoDB tables: 668.7M (Tables: 257)
[OK] Total fragmented tables: 0

-------- Analysis Performance Metrics --------------------------------------------------------------
[--] innodb_stats_on_metadata: ON
[!!] Stat are updated during querying INFORMATION_SCHEMA.

-------- Security Recommendations ------------------------------------------------------------------
[OK] There are no anonymous accounts for any database users
[OK] All database users have passwords assigned
[!!] User '03c80c5f5576@%' does not specify hostname restrictions.
[!!] User 'DM9ZBvPixIsl@%' does not specify hostname restrictions.
[!!] User 'Zvn7gXkCm4EW@%' does not specify hostname restrictions.
[!!] User 'qvsrhautff@%' does not specify hostname restrictions.
[!!] User 'uskjWSzJyOcq@%' does not specify hostname restrictions.
[!!] There is no basic password file list!

-------- CVE Security Recommendations --------------------------------------------------------------
[--] Skipped due to --cvefile option undefined

-------- Performance Metrics -----------------------------------------------------------------------
[--] Up for: 7m 14s (19K q [44.975 qps], 275 conn, TX: 167M, RX: 3M)
[--] Reads / Writes: 97% / 3%
[--] Binary logging is disabled
[--] Physical Memory : 7.8G
[--] Max MySQL memory : 597.8M
[--] Other process memory: 0B
[--] Total buffers: 192.0M global + 2.7M per thread (151 max threads)
[--] P_S Max memory usage: 0B
[--] Galera GCache Max memory usage: 0B
[OK] Maximum reached memory usage: 269.9M (3.39% of installed RAM)
[OK] Maximum possible memory usage: 597.8M (7.51% of installed RAM)
[OK] Overall possible memory usage with other process is compatible with memory available
[OK] Slow queries: 0% (143/19K)
[OK] Highest usage of available connections: 19% (29/151)
[OK] Aborted connections: 0.00% (0/275)
[!!] name resolution is active : a reverse name resolution is made for each new connection and can reduce performance
[!!] Query cache may be disabled by default due to mutex contention.
[!!] Query cache efficiency: 19.0% (3K cached / 17K selects)
[OK] Query cache prunes per day: 0
[OK] Sorts requiring temporary tables: 0% (0 temp sorts / 2K sorts)
[!!] Joins performed without indexes: 17
[!!] Temporary tables created on disk: 65% (759 on disk / 1K total)
[OK] Thread cache hit rate: 87% (34 created / 275 connections)
[OK] Table cache hit rate: 92% (400 open / 433 opened)
[OK] Open file limit used: 0% (111/65K)
[OK] Table locks acquired immediately: 100% (16K immediate / 16K locks)

-------- Performance schema ------------------------------------------------------------------------
[--] Performance schema is disabled.
[--] Memory used by P_S: 0B
[--] Sys schema isn't installed.

-------- ThreadPool Metrics ------------------------------------------------------------------------
[--] ThreadPool stat is disabled.

-------- MyISAM Metrics ----------------------------------------------------------------------------
[!!] Key buffer used: 18.5% (3M used / 16M cache)
[OK] Key buffer size / total MyISAM indexes: 16.0M/3.0M
[!!] Read Key buffer hit rate: 90.0% (502 cached / 50 reads)
[OK] Write Key buffer hit rate: 100.0% (132 cached / 132 writes)

-------- InnoDB Metrics ----------------------------------------------------------------------------
[--] InnoDB is enabled.
[--] InnoDB Thread Concurrency: 0
[OK] InnoDB File per table is activated
[!!] InnoDB buffer pool / data size: 128.0M/668.7M
[!!] Ratio InnoDB log file size / InnoDB Buffer pool size (7.8125 %): 5.0M * 2/128.0M should be equal 25%
[OK] InnoDB buffer pool instances: 1
[--] InnoDB Buffer Pool Chunk Size not used or defined in your version
[OK] InnoDB Read buffer efficiency: 99.09% (188393244 hits/ 190130421 total)
[!!] InnoDB Write Log efficiency: 88.24% (3325 hits/ 3768 total)
[OK] InnoDB log waits: 0.00% (0 waits / 443 writes)

-------- AriaDB Metrics ----------------------------------------------------------------------------
[--] AriaDB is disabled.

-------- TokuDB Metrics ----------------------------------------------------------------------------
[--] TokuDB is disabled.

-------- XtraDB Metrics ----------------------------------------------------------------------------
[--] XtraDB is disabled.

-------- Galera Metrics ----------------------------------------------------------------------------
[--] Galera is disabled.

-------- Replication Metrics -----------------------------------------------------------------------
[--] Galera Synchronous replication: NO
[--] No replication slave(s) for this server.
[--] Binlog format: STATEMENT
[--] XA support enabled: ON
[--] Semi synchronous replication Master: Not Activated
[--] Semi synchronous replication Slave: Not Activated
[--] This is a standalone server

-------- Recommendations ---------------------------------------------------------------------------
General recommendations:
Control warning line(s) into /var/log/mysql/error.log file
Control error line(s) into /var/log/mysql/error.log file
Restrict Host for user@% to user@SpecificDNSorIp
MySQL was started within the last 24 hours - recommendations may be inaccurate
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
Adjust your join queries to always utilize indexes
When making adjustments, make tmp_table_size/max_heap_table_size equal
Reduce your SELECT DISTINCT queries which have no LIMIT clause
Before changing innodb_log_file_size and/or innodb_log_files_in_group read this: https://bit.ly/2TcGgtU
Variables to adjust:
SET innodb_stats_on_metadata = OFF
query_cache_size (=0)
query_cache_type (=0)
query_cache_limit (> 1M, or use smaller result sets)
join_buffer_size (> 128.0K, or always use indexes with JOINs)
tmp_table_size (> 16M)
max_heap_table_size (> 16M)
innodb_buffer_pool_size (>= 668.7M) if possible.

1 Reply

If you are still running into problems after running 'mysqltuner' and making configuration changes that's been suggested, I'd also verify that you aren't running into disk space and inode issues for your server. The following commands will show the usage for both:

df -h
df -i

I also found a link that should provide further insight regarding the "df" command.

https://www.tecmint.com/how-to-check-disk-space-in-linux/

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct