diff options
-rw-r--r-- | collectors/statsd.plugin/statsd.c | 7 | ||||
-rw-r--r-- | libnetdata/dictionary/README.md | 9 |
2 files changed, 1 insertions, 15 deletions
diff --git a/collectors/statsd.plugin/statsd.c b/collectors/statsd.plugin/statsd.c index 42970bc7f3..cb78341a0c 100644 --- a/collectors/statsd.plugin/statsd.c +++ b/collectors/statsd.plugin/statsd.c @@ -20,15 +20,10 @@ // -------------------------------------------------------------------------------------- +// DO NOT ENABLE MULTITHREADING - IT IS NOT WELL TESTED // #define STATSD_MULTITHREADED 1 -#ifdef STATSD_MULTITHREADED -// DO NOT ENABLE MULTITHREADING - IT IS NOT WELL TESTED #define STATSD_DICTIONARY_OPTIONS (DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_ADD_IN_FRONT) -#else -#define STATSD_DICTIONARY_OPTIONS (DICT_OPTION_DONT_OVERWRITE_VALUE | DICT_OPTION_ADD_IN_FRONT | DICT_OPTION_SINGLE_THREADED) -#endif - #define STATSD_DECIMAL_DETAIL 1000 // floating point values get multiplied by this, with the same divisor // -------------------------------------------------------------------------------------------------------------------- diff --git a/libnetdata/dictionary/README.md b/libnetdata/dictionary/README.md index fc7b889fb5..6d7e55392e 100644 --- a/libnetdata/dictionary/README.md +++ b/libnetdata/dictionary/README.md @@ -229,12 +229,3 @@ There are 2 versions of `dfe_start`: While in the loop, depending on the read or write versions of `dfe_start`, the caller may lookup or manipulate the dictionary. The rules are the same with the unsorted walkthrough callback functions. PS: DFE is Dictionary For Each. - -## special multi-threaded lockless case - -Since the dictionary uses a hash table and a double linked list, if the contract between 2 threads is for one to use the hash table functions only (`set`, `get` - but no `del`) and the other to use the traversal ones only, the dictionary allows concurrent use without locks. - -This is currently used in statsd: - -- the data collection thread uses only `get` and `set`. It never uses `del`. New items are added at the front of the linked list (`DICT_OPTION_ADD_IN_FRONT`). -- the flushing thread is only traversing the dictionary up to the point it last traversed it (it uses a flag for that to know where it stopped last time). It never uses `get`, `set` or `del`. |