[ZBX-7918] Value cache free space statistics are incorrect Created: 2014 Mar 09 Updated: 2017 May 30 Resolved: 2014 Mar 10 |
|
Status: | Closed |
Project: | ZABBIX BUGS AND ISSUES |
Component/s: | Server (S) |
Affects Version/s: | 2.2.0 |
Fix Version/s: | 2.2.3rc1, 2.3.0 |
Type: | Incident report | Priority: | Minor |
Reporter: | Andris Zeila | Assignee: | Unassigned |
Resolution: | Fixed | Votes: | 0 |
Labels: | internalmonitoring, valuecache | ||
Remaining Estimate: | Not Specified | ||
Time Spent: | Not Specified | ||
Original Estimate: | Not Specified |
Attachments: |
![]() ![]() ![]() ![]() ![]() |
||||||||
Issue Links: |
|
Description |
Value cache free space statistics are calculated as total size - used space, which does not include the memory allocator overhead. So in reality it has less free space than reported.And the more small allocations are made, the less precise the free space statistics will be. A patch to fix it is attached: valuecache-statistics-fix2.diff |
Comments |
Comment by Andris Zeila [ 2014 Mar 09 ] |
While investigating value cache free space/fragmentation issues I found also the following minor bugs:
Also I tried the following improvements regarding memory usage:
|
Comment by Andris Zeila [ 2014 Mar 09 ] |
I experimented a bit with normalizing value cache chunk sizes to reduce memory fragmentation. While I managed to reduce the fragmentation (at least in my test setup), it did not really affect the size of stored data because of smaller chunks and data storage overhead for each chunk. Value cache statistics with 32bit memory allocator:
6688:20140308:211224.277 === memory statistics for value cache size ===
6688:20140308:211224.278 free chunks of size 24 bytes: 2
6688:20140308:211224.278 free chunks of size 32 bytes: 1
6688:20140308:211224.278 free chunks of size 56 bytes: 1
6688:20140308:211224.280 free chunks of size 64 bytes: 4963
6688:20140308:211224.280 free chunks of size 80 bytes: 2046
6688:20140308:211224.280 free chunks of size 88 bytes: 1
6688:20140308:211224.281 free chunks of size 96 bytes: 3069
6688:20140308:211224.281 free chunks of size 112 bytes: 43
6688:20140308:211224.281 free chunks of size 128 bytes: 82
6688:20140308:211224.281 free chunks of size 144 bytes: 2
6688:20140308:211224.282 free chunks of size 160 bytes: 3
6688:20140308:211224.282 free chunks of size 176 bytes: 1
6688:20140308:211224.282 free chunks of size 192 bytes: 1
6688:20140308:211224.282 min chunk size: 24 bytes
6688:20140308:211224.282 max chunk size: 198 bytes
6688:20140308:211224.282 memory of total size 8388214 bytes fragmented into 72025 chunks
6688:20140308:211224.282 of those, 792614 bytes are in 10215 free chunks
6688:20140308:211224.282 of those, 7019400 bytes are in 61810 used chunks
6688:20140308:211224.282 ================================
Value cache statistics with 32bit memory allocator and normalized value cache chunk sizes:
31155:20140309:005754.989 === memory statistics for value cache size ===
31155:20140309:005754.989 free chunks of size 24 bytes: 2
31155:20140309:005754.989 free chunks of size 56 bytes: 11
31155:20140309:005754.989 free chunks of size 64 bytes: 1
31155:20140309:005754.989 free chunks of size 200 bytes: 1
31155:20140309:005754.990 min chunk size: 24 bytes
31155:20140309:005754.990 max chunk size: 206 bytes
31155:20140309:005754.990 memory of total size 8388214 bytes fragmented into 84806 chunks
31155:20140309:005754.990 of those, 934 bytes are in 15 free chunks
31155:20140309:005754.990 of those, 7708832 bytes are in 84791 used chunks
31155:20140309:005754.990 ================================
The test case consisted of 500 hosts, 17 triggers per host plus a host with 38 triggers resulting in 8538 items cached by value cache. The items were only of uint or floating type, so basically the only allocations made buy value cache would be to store items, value chunks and the hashset itself. When we discard the overhead of chunk header storage the size of data stored in both cases are quite close:
Those tests were done on clean history, systems with existing history has less fragmentation. Bottom line - in current form the fragmentation optimizations aren't worth it. |
Comment by richlv [ 2014 Mar 09 ] |
well, that probably explains people reporting value cache "not filling up" and getting stuck at 80-90 % full wiper you could still get 90% because of fragmentation, but I've seen it switching to low memory mode when only 70% full. |
Comment by Aleksandrs Saveljevs [ 2014 Mar 10 ] |
Related issue: ZBX-7741. wiper Good, so the memory allocator chunk size changes will be resolved there. I attached the 32bit patch to it. |
Comment by Andris Zeila [ 2014 Mar 10 ] |
Created So only statistics (value cache and memory allocated) fixes will be addressed by this issue. |
Comment by Andris Zeila [ 2014 Mar 10 ] |
Fixed in development branch svn://svn.zabbix.com/branches/dev/ZBX-7918 |
Comment by Aleksandrs Saveljevs [ 2014 Mar 13 ] |
(1) Shall we fix memory statistics for zabbix[vmware] item, too? wiper Yes, but I think we must create a new issue for that. |
Comment by Andris Zeila [ 2014 Mar 13 ] |
Released in: |