Ad Widget

Collapse

MariaDB 100% CPU usage

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • troffasky
    Senior Member
    • Jul 2008
    • 567

    #1

    MariaDB 100% CPU usage

    Persistent issue with MariaDB CPU usage going to 100% as soon as Zabbix server process is started, or browsing to /zabbix/zabbix.php?action=problem.view. Problem view page very rarely loads, most of the time it just times out. I can get to other pages of the web interface.
    Started with Ubuntu 18.04 + MariaDB 10.1 + Zabbix 5.2.
    Dumped and restored Zabbix DB. No different.
    Dumped all DBs, purged MySQL config, reinstalled, restored entire DB. No different.
    Upgraded from Ubuntu 18.04 to 20.04 + MariaDB 10.3, no different.
    NVPS is 56.
    94 hosts, 5400 items, 3600 triggers.
    There are holes in the graphs, so sometimes it is collecting data, sometimes it is not.
    Constant slow query events:
    5989:20210827:161831.940 slow query: 60.814597 sec, "select clock,ns,value from history where itemid=66660 and clock>1630075560"
    5993:20210827:161832.443 slow query: 61.340636 sec, "select clock,ns,value from history where itemid=66510 and clock<=1630075410 and clock>1630071810 order by clock desc limit 2"
    5990:20210827:161836.066 slow query: 62.948542 sec, "select clock,ns,value from history where itemid=65515 and clock>1630075380"



    I am not sure where to go with this. It's our smallest Zabbix install, yet somehow causes the most CPU usage!
    Last edited by troffasky; 27-08-2021, 17:25.
  • troffasky
    Senior Member
    • Jul 2008
    • 567

    #2
    From the 100% CPU server:

    Code:
    "show create table history;"
    +---------+-----------------------------------------------------------------------------
    | Table | Create Table
    +---------+-----------------------------------------------------------------------------
    | history | CREATE TABLE `history` (
    `itemid` bigint(20) unsigned NOT NULL,
    `clock` int(11) NOT NULL DEFAULT 0,
    `value` double NOT NULL DEFAULT 0,
    `ns` int(11) NOT NULL DEFAULT 0
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |
    +---------+-----------------------------------------------------------------------------
    From a server with 10x the NVPS, hosts, etc, but much more reasonable MySQL usage stats:

    Code:
    "show create table history;"
    +---------+-----------------------------------------------------------------------------
    | Table | Create Table
    +---------+-----------------------------------------------------------------------------
    | history | CREATE TABLE `history` (
    `itemid` bigint(20) unsigned NOT NULL,
    `clock` int(11) NOT NULL DEFAULT '0',
    `value` double(16,4) NOT NULL DEFAULT '0.0000',
    `ns` int(11) NOT NULL DEFAULT '0',
    KEY `history_1` (`itemid`,`clock`)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin |
    Would the KEY not being on this table cause this?

    Comment

    • troffasky
      Senior Member
      • Jul 2008
      • 567

      #3
      Added index to table, issue is resolved. I copied this from a Zabbix install:

      Comment

      Working...