[ZBXNEXT-2462] Optimize value cache data fetching for nodata() functions Created: 2014 Sep 18 Updated: 2015 Apr 23 Resolved: 2014 Sep 19 |
|
Status: | Closed |
Project: | ZABBIX FEATURE REQUESTS |
Component/s: | Server (S) |
Affects Version/s: | None |
Fix Version/s: | 2.5.0 |
Type: | Change Request | Priority: | Minor |
Reporter: | Andris Zeila | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | performance, valuecache | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Description |
The nodata() function retrieves last value from value cache and checks if its timestamp is inside the nodata period. This can result in retrieving value a way beyond the specified range (for example if server was not running for few days). To optimize nodata() evaluation zbx_vc_get_value_range() function must support both - time period and value count parameters at the same time. This will allow nodata() function to request one value from the specified period and return 0 or 1 depending on if a value was returned or not. |
Comments |
Comment by Andris Zeila [ 2014 Sep 19 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBXNEXT-2462 |
Comment by dimir [ 2015 Apr 13 ] |
(1) [S] In case there are enough values in the database in function vc_db_read_values_by_time_and_count() we do not collect possible values from the last second in first select. We have obligatory requirement "no split by second" (as wiper mentioned). At the end of the function we handle this situation by calling vc_db_read_values_by_time() but it is not clear why we are not collecting the values on first select. This should just be reviewed and either fixed or explained why this was implemented this way. wiper On the second thought we can't do that because we are using DBselectN rather than DBselect when performing the initial select. |
Comment by dimir [ 2015 Apr 13 ] |
(2) [S] Small improvement. In zbx_vc_add_value() we could check if item state is ZBX_ITEM_STATE_REMOVE_PENDING before checking if the item is valid. wiper RESOLVED in r53137 <dimir> CLOSED |
Comment by dimir [ 2015 Apr 13 ] |
(3) [S] In function vch_item_cache_values_by_time_and_count() it looks like we double check current value range of an item: /* check if the requested period is in the cached range */ if (0 != item->active_range && update_end - start <= item->active_range) return SUCCEED; /* find if the cache should be updated to cover the required count */ if (NULL != item->head) { zbx_vc_chunk_t *chunk; int index; /* the cache contents covers the requested range */ if (timestamp - seconds + 1 >= item->tail->slots[item->tail->first_value].timestamp.sec) return SUCCEED; wiper RESOLVED in r53137 <dimir> CLOSED |
Comment by dimir [ 2015 Apr 13 ] |
(4) [S] In function vch_item_cache_values_by_time_and_count() we call vc_db_read_values_by_time_and_count() and then vc_db_read_values_by_time() (besides another call to get last second values mentioned in sub-issue (1)): vc_try_unlock(); ret = vc_db_read_values_by_time_and_count(item->itemid, item->value_type, &records, seconds, count - cached_records, timestamp < update_end ? timestamp : update_end, &queries); if (SUCCEED == ret && update_end > timestamp) { ret = vc_db_read_values_by_time(item->itemid, item->value_type, &records, update_end - timestamp, update_end, &queries); } Could we change that to collect all the needed values by first function call? wiper It's simpler to keep it separate, as vc_db_read_values_by_time_and_count() function is used also to directly read values from database in low memory mode. <dimir> Got it. CLOSED |
Comment by Andris Zeila [ 2015 Apr 15 ] |
Available at:
|
Comment by Alexander Vladishev [ 2015 Apr 21 ] |
(5) It should be mentioned in What's new in Zabbix 3.0.0 wiper RESOLVED sasha Great! CLOSED |