[ZBX-6761] dbConditionInt is much slow for a lot of objects Created: 2013 Jul 02  Updated: 2017 May 30  Resolved: 2013 Jul 17

Status: Closed
Project: ZABBIX BUGS AND ISSUES
Component/s: Frontend (F)
Affects Version/s: 2.0.7rc1, 2.1.0
Fix Version/s: 2.0.7rc1, 2.2.0

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

PHP 5.3.13


Attachments: PNG File CEvents class.png     PNG File events_debug.png     Text File events_query.log    
Issue Links:
Duplicate

 Description   

For example dbConditionInt processes 200.000 objects about 80 seconds. It happens on Monitoring->Events page when triggerids are passed to Events class.



 Comments   
Comment by richlv [ 2013 Jul 03 ]

is ZBX-6763 related in any way ?

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 09 ]

Improved in development branch svn://svn.zabbix.com/branches/dev/ZBX-6761

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 09 ]

Test results for 100 000 values

Old algorithm:
1) Time: 133 sec, memory: 7,04 Mb, peak memory: 29,46 Mb
2) Time: 134 sec, memory: 7,05 Mb, peak memory: 29,46 Mb
3) Time: 131 sec, memory: 7,04 Mb, peak memory: 29,46 Mb

New algorithm:
1) Time: 1.8 sec, memory: 19,07 Mb, peak memory: 40,59 Mb
2) Time: 1.8 sec, memory: 19,07 Mb, peak memory: 40,58 Mb
3) Time: 1.8 sec, memory: 19,08 Mb, peak memory: 40,60 Mb

Comment by Alexey Pustovalov [ 2013 Jul 12 ]

Old algorithm:
Not opened 300 seconds timeout exceeded.
New algorithm:

******************** Script profiler ********************
Total time: 40.445509
Total SQL time: 15.69946
SQL count: 729 (selects: 684 | executes: 45)
Peak memory usage: 281.75M
Memory limit: 2048M 

Eduards How many values you have?

dotneft

Events	
Group  Host  Source 
Displaying 1 to 300 of 5000+ found

and

Number of hosts (monitored/not monitored/templates)	23361	23333 / 9 / 19
Number of items (monitored/disabled/not supported)	2497050	2361618 / 135389 / 43
Number of triggers (enabled/disabled)[problem/unknown/ok]	203570	203566 / 4  [478 / 0 / 203088]
Number of users (online)	154	14
Required server performance, new values per second	3943.06	 -

Eduards 2,5 million of items - Атас!

Comment by Oleg Egorov (Inactive) [ 2013 Jul 12 ]

New algorithm:
In small queries - x10 slower and use x10 more memory

Comment by Oleg Egorov (Inactive) [ 2013 Jul 12 ]

(1)
Code:

$values = array(1,2,3,4,5);
$result = dbConditionInt('field', $values, false);

Old algorithm:
Result: field BETWEEN '1' AND '5'

New algorithm:
Result: field IN ('1','2','3','4','5')

Eduards RESOLVED r.36946, r.36947, r.36948

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 12 ]

(2) Array ( [0] => 6 [1] => 4 [2] => 2 [3] => 2 [4] => 6 [5] => 5 [6] => 5 [7] => 6 [8] => 1 [9] => 1 [10] => 5 [11] => 6 [12] => 5 [13] => 1 [14] => 6 [15] => 5 [16] => 6 [17] => 5 [18] => 6 [19] => 6 )

$values = array(6,4,2,2,6,5,5,6,1,1,5,6,5,1,6,5,6,5,6,6);

Old algorithm:
Result: field NOT IN ('6','4','2','2','6','5','5','6','1','1','5','6','5','1','6','5','6','5','6','6')

New algorithm:
Result: (NOT field BETWEEN '1' AND '1' AND field NOT IN ('6','4','2','2','6','5','5','6','1','6','5','6','5','6','6'))

Sometimes between is 1-1, 1-3, 1-4...

Eduards RESOLVED r.36946

oleg.egorov CLOSED

Comment by Oleg Egorov (Inactive) [ 2013 Jul 15 ]

TESTED

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 16 ]

Fixed in versions 2.2.0 (trunk) r.36988, pre-2.1.1 (alpha) r.36989, 2.0.7rc1 r.36992

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 16 ]

Once more improvements up 30%!

Fixed in versions 2.2.0 (trunk) r.37033, 2.0.7rc1 r.37035

Comment by richlv [ 2013 Jul 16 ]

(3) please mention this in whatsnew

Eduards RESOLVED in https://www.zabbix.com/documentation/2.0/manual/introduction/whatsnew207

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 17 ]

(4) PHP errors if input parameter is boolean

Eduards RESOLVED r.37057, r.37060

jelisejev An array containing a boolean value to be exact. CLOSED.

Comment by Pavels Jelisejevs (Inactive) [ 2013 Jul 17 ]

TESTED.

Comment by Eduards Samersovs (Inactive) [ 2013 Jul 17 ]

Fixed in versions 2.2.0 (trunk) r.37066, 2.0.7rc1 r.37065

Generated at Tue Apr 16 10:34:24 EEST 2024 using Jira 9.12.4#9120004-sha1:625303b708afdb767e17cb2838290c41888e9ff0.