Global cache

From collectd Wiki
Jump to: navigation, search

There is a global cache into which all values that are handled by collectd are inserted. There are two major uses for this cache:

  • Convert COUNTER, DERIVE, and ABSOLUTE values to a rate, i. e. a GAUGE value.
  • Recognize missing values.

Values are identified by their identifier which can be constructed from the value_list_t data structure.

Functions to access the cache are declared in src/utils_cache.h.

The cache uses an AVL-tree, a balanced binary search tree, to store and retrieve the values. This has proven to be efficient even when handling thousands of entries.

It is possible to attach meta data to an entry in the cache (version 4.8 and later), which allows for stateful decisions in the filter infrastructure, eliminates the need for separate caches (for example in the Network plugin) and other nice uses.