Uploaded image for project: 'ZABBIX BUGS AND ISSUES'
  1. ZABBIX BUGS AND ISSUES
  2. ZBX-7920

Value cache internal allocation optimizations

XMLWordPrintable

    • Icon: Problem report Problem report
    • Resolution: Unresolved
    • Icon: Trivial Trivial
    • None
    • 2.2.0
    • Server (S)
    • Sprint 51 (Apr 2019), Sprint 52 (May 2019), Sprint 53 (Jun 2019), Sprint 54 (Jul 2019)

      1) Reduce data chunk header size.
      To keep track of chunk slots (total, first, last) variables of type int (4 bytes) are used. However chunks are limited to 64KB, so the number of lots can't be larger than ~4KB. Therefore we can safely use variables of type short 2 (bytes) to keep track of used slots. This will reduce the size of chunk header by 4 bytes (padding included). The patch is attached - valuecache-small-chunk-header.diff

      2) Reduce initial value cache fragmentation
      When starting up the value cache memory allocation pattern is like:
      [item][data][item][data][item][data][item]...

      After some time the data chunks goes out of request range and are freed:
      [item][free chunk][item][free chunk][item]...

      However item freeing is not likely, so this memory will stay fragmented. To reduce this fragmentation it would be better to create a pool of pre-allocated items and take new items from this pool. Whenever the pool runs out of free items - create a new one. This way the items will not be interleaved with their data in value cache memory, resulting in less initial fragmentation:
      [item][item][item][item].....[data][data][data][data]....

        1. valuecache-small-chunk-header.diff
          0.6 kB
          Andris Zeila
        2. vc-hashset.diff
          8 kB
          Andris Zeila

            alexei Alexei Vladishev
            wiper Andris Zeila
            Votes:
            0 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: