[ZBX-8232] Performance issue in maps Created: 2014 May 20  Updated: 2017 May 30  Resolved: 2014 Aug 28

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.2.4rc1, 2.3.0
Fix Version/s: 2.2.8rc1, 2.4.2rc1, 2.5.0

Type: Incident report Priority: Blocker
Reporter: Ivo Kurzemnieks Assignee: Unassigned
Resolution: Fixed Votes: 1
Labels: maps, performance
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates ZBXNEXT-2495 Index by value and lastchange in trig... Closed

 Description   

Map loading time can reach to 30 or more seconds having 35k about triggers from all monitored hosts and groups and PHP can run out of memory. SQL execution time is fine, however gathering data, building resulting array for trigger.get method can cause high memory usage and page execution time.



 Comments   
Comment by Oleg Egorov (Inactive) [ 2014 May 26 ]

(1) ZBX-7983 (9) Should be fixed under this issue

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Jul 31 ]

Without patch:
Total time: 29.37168
Total SQL time: 15.449883
SQL count: 131 (selects: 63 | executes: 68)
Peak memory usage: 98M
Memory limit: 1024M

With patch:
Total time: 15.319876
Total SQL time: 7.881452
SQL count: 130 (selects: 62 | executes: 68)
Peak memory usage: 102M
Memory limit: 1024M

Comment by Oleg Egorov (Inactive) [ 2014 Sep 01 ]

Tested, but waiting for performance tests

Comment by Oleg Ivanivskyi [ 2014 Sep 04 ]

That was before:

Zabbix 2.2.3 (No patch):
Total time: 20.105711
Total SQL time: 11.068346
SQL count: 131 (selects: 63 | executes: 68)
Peak memory usage: 245.5M
Memory limit: 4096M

There are the performance tests results:

Map as Admin
-----
Total time: 4.16762
Total SQL time: 4.115221
SQL count: 130 (selects: 61 | executes: 69)
Peak memory usage: 5.25M
Memory limit: 4096M

Latest Data (single host) as Admin
-----
Total time: 2.398645
Total SQL time: 0.832014
SQL count: 2143 (selects: 2107 | executes: 36)
Peak memory usage: 40M
Memory limit: 4096M

While as a not-admin user (with rights to see the same objects) the loading times seem to be higher in maps loading (but reduced in this case too):

Map as Not-Admin
-----
Tempo totale: 12.837763
Tempo totale SQL: 12.776925
Conteggio SQL: 164 (selezioni: 95 | esecuzioni: 69)
Limite utilizzo memoria: 5.75M
Limite di memoria: 4096M

Latest Data as Not-Admin
-----
Tempo totale: 2.411242
Tempo totale SQL: 0.896081
Conteggio SQL: 2145 (selezioni: 2108 | esecuzioni: 37)
Limite utilizzo memoria: 40.25M
Limite di memoria: 4096M

It's better but not excellent.

oleg.egorov Under this ZBX improved performance only in maps

Comment by Oleg Egorov (Inactive) [ 2014 Oct 06 ]

Improvement by triggers_2 index changes moved to ZBXNEXT-2495

Comment by Oleg Egorov (Inactive) [ 2014 Oct 20 ]

(2)

  • Please don't use
    'output' => API_OUTPUT_EXTEND
    
  • If you change API request array, in maps.inc.php:1182
    		$triggerOptions = array(
    			'hostids' => $monitored_hostids,
    			'output' => array('status', 'value', 'priority', 'lastchange', 'description', 'expression'),
    			'selectHosts' => array('hostid'),
    			'nopermissions' => true,
    			'filter' => array('state' => null),
    			'nodeids' => get_current_nodeid(true),
    			'monitored' => true,
    			'skipDependent' => true,
    			'only_true' => true
    		);
    

Please make refactoring

'output'
'selectHosts'
...
  • Same issue in 464 line
		$item = API::Item()->get(array(
			'webitems' => true,
			'filter' => array(
				'host' => $itemHost,
				'key_' => $key
			),
			'output' => array('itemid', 'value_type', 'units', 'valuemapid')
		));
  • You active use $show_unack variable, please rename it, using camelCase

iivs

  • line 464 is in function resolveMapLabelMacros() and it has been moved in later versions to class. I don't think it's a good idea to refactor this piece of code for 2.2;
  • I renamed $show_unack to $showUnacknowledged, but only in that function so there are no conflicts to later versions;
  • API_OUTPUT_EXTEND has been replaced.

RESOLVED in r50077

oleg.egorov See sysmap 1,29 and 30 in db o_22_test
And check in maps.inc.php:1257

iivs It appears that previously we selected problematic unacknowledged triggers using "withLastEventUnacknowledged" option, which selects data from events table and "value" mismatched trigger "value". It did not return any results, so it appeared that triggers were actually not in problem state, although they were according to trigger value.

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2014 Oct 23 ]

TESTED

Comment by Ivo Kurzemnieks [ 2014 Oct 24 ]

Fixed in:

  • pre-2.2.8rc1 r50172
  • pre-2.4.2rc1 r50174
  • pre-2.5.0 (trunk) r50176
Generated at Thu Mar 28 18:27:17 EET 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.