[ZBX-20706] Zabbix SQL Query causing 100% Usage with MariaDB Makes Zabbix Unusable Created: 2022 Mar 03 Updated: 2023 Jun 28 Resolved: 2022 Jul 13 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | Problem report | Priority: | Trivial |
Reporter: | Travis Johnson | Assignee: | Zabbix Development Team |
Resolution: | Duplicate | Votes: | 0 |
Labels: | performance, usability | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified | ||
Environment: |
Three RHEL 8.5 nodes with 2 CPUs, 4 GB RAM. Web front end with MariaDB on one node, Zabbix Server on 2 other nodes in HA configuration |
Attachments: |
![]() ![]() ![]() ![]() ![]() ![]() |
||||||||||||||||
Issue Links: |
|
Description |
Steps to reproduce:
Result: See zabbix_server_logs screenshot... See attached zabbix_sql_query.txt... Expected: |
Comments |
Comment by Edgar Akhmetshin [ 2022 Mar 04 ] |
Hello Travis, Please provide additional information:
Also MariaDB configuration file would be helpful. Regards, |
Comment by Travis Johnson [ 2022 Mar 04 ] |
Hi Edgar, Here is the output from the commands you provided: select version(); 10.6.7-MariaDB see table_size.csv see trigger_query.csv see server.cnf
Additionally, our zabbix cluster is brand new and we haven't added many devices yet. Please let me know if you need anything else! |
Comment by Edgar Akhmetshin [ 2022 Mar 07 ] |
Do you have any additional database configuration files (in include directories for example)? |
Comment by Fernando Collado Permuy [ 2022 Mar 07 ] |
Just my two cents here, we're seeing the same behavior with MariaDB 10.6, Rocky Linux 8, and Zabbix 6.0. Using a very simple test environment, a small vagrant machine with MariaDB 10.6 from the official MariaDB Repo (no tunning at all in my.cnf) and a clean Zabbix 6 install (no other hosts added only the default Zabbix server host), and we get a lot of slow queries with the same select: 977:20220307:113729.416 slow query: 51.571350 sec, "select distinct d.triggerid_down,d.triggerid_up from trigger_depends d,triggers t,hosts h,items i,functions f where t.triggerid=d.triggerid_down and t.flags<>2 and h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=d.triggerid_down and h.status in (0,1)" 977:20220307:113922.890 slow query: 52.474598 sec, "select distinct d.triggerid_down,d.triggerid_up from trigger_depends d,triggers t,hosts h,items i,functions f where t.triggerid=d.triggerid_down and t.flags<>2 and h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=d.triggerid_down and h.status in (0,1)" 977:20220307:114118.002 slow query: 53.586517 sec, "select distinct d.triggerid_down,d.triggerid_up from trigger_depends d,triggers t,hosts h,items i,functions f where t.triggerid=d.triggerid_down and t.flags<>2 and h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=d.triggerid_down and h.status in (0,1)" 977:20220307:114313.576 slow query: 54.160693 sec, "select distinct d.triggerid_down,d.triggerid_up from trigger_depends d,triggers t,hosts h,items i,functions f where t.triggerid=d.triggerid_down and t.flags<>2 and h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=d.triggerid_down and h.status in (0,1)" 977:20220307:114506.700 slow query: 51.791388 sec, "select distinct d.triggerid_down,d.triggerid_up from trigger_depends d,triggers t,hosts h,items i,functions f where t.triggerid=d.triggerid_down and t.flags<>2 and h.hostid=i.hostid and i.itemid=f.itemid and f.triggerid=d.triggerid_down and h.status in (0,1)" Rolling back to MariaDB 10.5 seems to solve the problem. |
Comment by Vladislavs Sokurenko [ 2022 May 02 ] |
Currently looks like query analyser in MariaDB is misbehaving and not planning query correctly because there shouldn't be many trigger_depends but it looks like it just attempts to read all triggers, functions, hosts and items regardless of this fact, best solution would be to read all trigger dependencies without also finding related triggers, hosts, items and functions, alternative could be to add inner join to give more hints for MariaDB query analyser that it should only find related information for trigger_depends table. |
Comment by Vladislavs Sokurenko [ 2022 May 11 ] |
Related issue: |
Comment by Vladislavs Sokurenko [ 2022 Jul 13 ] |
Thank you for your report, closing as a duplicate of |