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

nodata function inneficiency

    XMLWordPrintable

Details

    • Patch request
    • Status: Closed
    • Major
    • Resolution: Won't fix
    • None
    • None
    • Server (S)
    • any

    Description

      While doing alternative implementation of value cache to improve speed and avoid locks i have found that the original implementation stores a lot of items in the value cache for unknown reasons.

      Investigating the issue i realized the problem is in current implementation of the nodata function (in both evalfunc.c and evalfunc2.c) which if quite inefficient:

      if (SUCCEED == zbx_vc_get_values(item->host.hostid, item->itemid, item->value_type, &values, period, 1, &ts) ...
      

      code fetches all the data from the cache for period 'period' and causes the valuecache 1) remember demand for the item as period "period" and 2) actively load the data from the db storage.

      replacing that with getting only the latest item from the cache like this:

      if (SUCCEED != (ret = glb_cache_get_item_values(item->itemid, item->value_type, &values, 0 , 1, ts.sec))) 
      

      and comparing cached latest value's timestamp to request period will:

      1. set cache demand to have only one item
      2. it might be that there will be some data already, so it will eliminate need to fetch it from the db at all}}
      3. will not require db requests if nodata is used with periods of more then maximum cache age (24h)

      Having that fixed along with own cache implementation (which is out of this ticket scope) greatly improves server startup time along with database pressure especially if there are lots of nodata checks implemented

       

      Attachments

        Activity

          People

            zabbix.dev Zabbix Development Team
            makurov Mikhail Makurov
            Votes:
            3 Vote for this issue
            Watchers:
            11 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: