[ZBX-1371] very slow template listing Created: 2009 Nov 26  Updated: 2017 May 30  Resolved: 2010 Mar 04

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 1.9.0 (alpha)
Fix Version/s: 1.8.2

Type: Incident report Priority: Major
Reporter: richlv Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

rev 8376


Attachments: PNG File hostgroups_spacing.png    

 Description   

template listing in configuration is very slow, especially after deleting a template.

for example, total of 3.154554 seconds, with only 0.235159 spent on sql queries

Total time: 3.154554
SQL selects count: 28
SQL executes count: 20
SQL requests count: 48
Time:9.5E-5 SQL: SET NAMES utf8
Time:5.0E-5 SQL: SET CHARACTER SET utf8
Time:0.000369 SQL: SELECT * FROM nodes WHERE nodetype=1 ORDER BY nodeid
Time:0.000402 SQL: SELECT u.,s. FROM sessions s,users u WHERE s.sessionid='2b559ed323dc60821b1a859667c6cf55' AND s.status=0 AND s.userid=u.userid AND ((s.lastaccess+u.autologout>1259240819) OR (u.autologout=0)) AND (u.userid div 100000000000000) in (0)
Time:0.000257 SQL: SELECT MAX(g.gui_access) as gui_access FROM usrgrp g, users_groups ug WHERE ug.userid=1 AND g.usrgrpid=ug.usrgrpid
Time:0.000224 SQL: SELECT g.usrgrpid FROM usrgrp g, users_groups ug WHERE ug.userid = 1 AND g.usrgrpid = ug.usrgrpid AND g.users_status = 1 LIMIT 1 OFFSET 0
Time:0.000417 SQL: UPDATE sessions SET lastaccess=1259240819 WHERE sessionid='2b559ed323dc60821b1a859667c6cf55'
Time:0.000293 SQL: SELECT g.usrgrpid FROM usrgrp g, users_groups ug WHERE ug.userid = 1 AND g.usrgrpid = ug.usrgrpid AND g.debug_mode = 1 LIMIT 1 OFFSET 0
Time:0.00169 SQL: SELECT * FROM profiles WHERE userid=1 AND (profileid div 100000000000000) in (0) ORDER BY userid ASC, profileid ASC
Time:0.002497 SQL: UPDATE profiles SET value_id=0, value_int=0, value_str='hosts.php', type=3, source='' WHERE userid=1 AND idx='web.menu.config.last' AND (profileid div 100000000000000) in (0)
Time:0.000342 SQL: SELECT * FROM config WHERE (configid div 100000000000000) in (0)
Time:0.000374 SQL: SELECT title1, url1, title2, url2, title3, url3, title4, url4, title5, url5 FROM user_history WHERE userid=1
Time:0.000663 SQL: UPDATE profiles SET value_id=0, value_int=0, value_str='host', type=3, source='' WHERE userid=1 AND idx='web.templates.php.sort' AND (profileid div 100000000000000) in (0)
Time:0.023981 LONG SQL: UPDATE profiles SET value_id=0, value_int=0, value_str='ASC', type=3, source='' WHERE userid=1 AND idx='web.templates.php.sortorder' AND (profileid div 100000000000000) in (0)
Time:0.000554 SQL: SELECT h.hostid FROM hosts h WHERE (h.hostid div 100000000000000) in (0) AND h.status=3 AND (h.hostid IN (10068))
Time:5.1E-5 SQL: begin
Time:0.000353 SQL: SELECT h.* FROM hosts h, hosts_templates ht WHERE h.hostid=ht.hostid AND (ht.templateid IN (10068))
Time:0.000347 SQL: SELECT * FROM items WHERE (hostid IN (10068))
Time:0.000228 SQL: SELECT selementid FROM sysmaps_elements WHERE (elementid IN (10068)) AND elementtype=0
Time:0.000132 SQL: DELETE FROM maintenances_hosts WHERE (hostid IN (10068))
Time:0.000205 SQL: DELETE FROM hosts_groups WHERE (hostid IN (10068))
Time:0.000121 SQL: DELETE FROM hosts_templates WHERE (hostid IN (10068))
Time:0.000111 SQL: DELETE FROM applications WHERE (hostid IN (10068))
Time:0.000274 SQL: SELECT DISTINCT actionid FROM conditions WHERE conditiontype=1 AND (value IN ('10068'))
Time:0.000153 SQL: UPDATE actions SET status=1 WHERE (actionid IN (-1))
Time:0.000249 SQL: SELECT DISTINCT o.actionid FROM operations o WHERE o.operationtype IN (4,5) AND (o.objectid IN (10068))
Time:0.000145 SQL: DELETE FROM conditions WHERE conditiontype=1 AND (value IN ('10068'))
Time:0.000146 SQL: DELETE FROM operations WHERE operationtype IN (6,7) AND (objectid IN (10068))
Time:0.000101 SQL: DELETE FROM hosts_profiles WHERE (hostid IN (10068))
Time:0.000145 SQL: DELETE FROM hosts_profiles_ext WHERE (hostid IN (10068))
Time:0.000738 SQL: SELECT DISTINCT ht.* FROM httptest ht, applications ap WHERE (ap.hostid IN (10068)) AND ht.applicationid=ap.applicationid
Time:0.000336 SQL: SELECT * FROM hosts WHERE hostid=10068
Time:0.000204 SQL: DELETE FROM hosts WHERE hostid=10068
Time:0.000216 SQL: SELECT nextid FROM ids WHERE nodeid=0 AND table_name='auditlog' AND field_name='auditid'
Time:0.000218 SQL: UPDATE ids SET nextid=nextid+1 WHERE nodeid=0 AND table_name='auditlog' AND field_name='auditid'
Time:0.000188 SQL: SELECT nextid FROM ids WHERE nodeid=0 AND table_name='auditlog' AND field_name='auditid'
Time:0.000185 SQL: INSERT INTO auditlog (auditid,userid,clock,ip,action,resourcetype,resourceid,resourcename) values (2922,1,1259240820,'127.0.0.1',2,4,10068,'testtemplate')
Time:0.000286 SQL: commit
Time:0.000349 SQL: SELECT g.* FROM groups g WHERE (g.groupid div 100000000000000) in (0)
Time:0.002125 SQL: SELECT h.* FROM hosts h WHERE (h.hostid div 100000000000000) in (0) AND h.status=3 ORDER BY h.host ASC LIMIT 1001 OFFSET 0
Time:0.012161 LONG SQL: SELECT h.* FROM hosts h WHERE (h.hostid div 100000000000000) in (0) AND h.status=3 AND (h.hostid IN (10065,10078,10054,10056,10053,10096,10077,10076,10025,10026,10012,10027,10020,10003,10031,10028,10029,10030,10023,10032,10018,10022,10033,10034,10019,10024,10008,10035,10013,10036,10021,10038,10042,10039,10001,10014,10040,10041,10044,10046,10011,10009,10045,10016,10007,10015,10004,10043,10010,10002))
Time:0.001206 SQL: SELECT h.*,ht.hostid as linked_hostid FROM hosts h,hosts_templates ht WHERE (h.hostid div 100000000000000) in (0) AND h.status=3 AND (ht.hostid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096)) AND h.hostid=ht.templateid
Time:0.006028 SQL: SELECT h.*,ht.templateid FROM hosts h,hosts_templates ht WHERE (h.hostid div 100000000000000) in (0) AND (ht.templateid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096)) AND h.hostid=ht.hostid AND h.status IN (0,1,3)
Time:0.127972 LONG SQL: SELECT i.* FROM items i WHERE (i.itemid div 100000000000000) in (0) AND i.type<>9 AND (i.hostid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096))
Time:0.01947 LONG SQL: SELECT t.*,i.hostid FROM triggers t,functions f,items i WHERE (t.triggerid div 100000000000000) in (0) AND (i.hostid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096)) AND f.triggerid=t.triggerid AND f.itemid=i.itemid
Time:0.0267 LONG SQL: SELECT g.*,i.hostid FROM graphs g,graphs_items gi,items i WHERE (g.graphid div 100000000000000) in (0) AND (i.hostid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096)) AND gi.graphid=g.graphid AND i.itemid=gi.itemid
Time:0.001434 SQL: SELECT a.* FROM applications a WHERE (a.applicationid div 100000000000000) in (0) AND (a.hostid IN (10001,10002,10003,10004,10007,10008,10009,10010,10011,10012,10013,10014,10015,10016,10018,10019,10020,10021,10022,10023,10024,10025,10026,10027,10028,10029,10030,10031,10032,10033,10034,10035,10036,10038,10039,10040,10041,10042,10043,10044,10045,10046,10053,10054,10056,10065,10076,10077,10078,10096))
Time:0.000374 SQL: SELECT title5, url5 FROM user_history WHERE userid=1
Total time spent on SQL: 0.235159



 Comments   
Comment by Alexei Vladishev [ 2009 Nov 26 ]

It is also in configuration of hosts. I have 500 hosts in one page, only 1 second is spent on SQLs, other time is in PHP code. Must be some inefficiency in the PHP functions.

Comment by richlv [ 2010 Mar 04 ]

performance has improved, but slight regression in this branch - it introduces excessive spacing in host group configuration screen (see the screenshot).

while splitting templates and hosts is great, there should not be an empty line inbetween

Comment by richlv [ 2010 Mar 04 ]

spacing kept for visual clarity

Comment by Artem Suharev (Inactive) [ 2010 Mar 04 ]

Implemented

Comment by richlv [ 2010 Mar 04 ]

reopening for edits

Generated at Sat Apr 20 15:20:33 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.