Ad Widget

Collapse

performance calculating pie min,max,avg with long period

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fjrial
    Senior Member
    • Feb 2010
    • 140

    #1

    performance calculating pie min,max,avg with long period

    Hi:

    I have an issue getting a screen with a period of one year.
    This screen has 30 graphs (with 2 items each), and it seems that the min,max,avg query locks the mysql server and causes that the queue grows too much during this.

    Executing the sql queries by hand, getting the min,max,avg values for a graph (period of one year) takes about 30 seconds for the first graph, and then the time for each calculation grows to 50 seconds and more..

    During all this time, zabbix_server seems to have problems inserting records (due to the locks, I guess).

    I´m using 1.8.2, so, Is this issue resolved in any newer versions? How could this query be optimized?

    array_push($sql_arr,
    'SELECT itemid,'.$calc_field.' as i,'.
    ' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
    ' max(value_max) as max,max(clock) as clock'.
    ' FROM trends '.
    ' WHERE itemid='.$this->items[$i]['itemid'].
    ' AND clock>='.$from_time.
    ' AND clock<='.$to_time.
    ' GROUP BY itemid,'.$calc_field
    ,

    'SELECT itemid,'.$calc_field.' as i,'.
    ' sum(num) as count,avg(value_avg) as avg,min(value_min) as min,'.
    ' max(value_max) as max,max(clock) as clock'.
    ' FROM trends_uint '.
    ' WHERE itemid='.$this->items[$i]['itemid'].
    ' AND clock>='.$from_time.
    ' AND clock<='.$to_time.
    ' GROUP BY itemid,'.$calc_field
    );
    Last edited by fjrial; 05-11-2012, 18:05. Reason: fix some typos
  • fjrial
    Senior Member
    • Feb 2010
    • 140

    #2
    to summarize... the main problem is that a query that performs a select from trends for a large period takes several minutes to finish..

    so, screen with 30 graphs with 2 items per graph with a period of one year makes zabbix queue grows a lot (and leads to unable to monitor services for a while)..

    any approach to perform this query without interrupting the zabbix_server

    mysql server with MyISAM engine.

    Comment

    Working...