diff options
author | Costa Tsaousis <costa@netdata.cloud> | 2023-06-29 15:02:13 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-29 15:02:13 +0300 |
commit | c62dcb2a9bd8ca6ec0c483bb3506c733d96648c6 (patch) | |
tree | 15f9e27879cfb951fa853fcb4f570066cb7f54a6 /streaming/rrdpush.h | |
parent | a1503807bb57399eae83606146281036da25e610 (diff) |
Optimizations part 2 (#15280)
* make all pluginsd functions inline, instead of function pointers
* dynamic MRG partitions based on the number of CPUs
* report the right size of the MRG
* prevent invalid read on pluginsd exit
* faster service_running() check; fix compiler warnings; shutdown replication after streaming to prevent crash on shutdown
* sender is now using a spinlock
* rrdcontext uses spinlock
* replace select() with poll()
* signed calculation of threads
* disable read-ahead on jnfv2 files during scan
Diffstat (limited to 'streaming/rrdpush.h')
-rw-r--r-- | streaming/rrdpush.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/streaming/rrdpush.h b/streaming/rrdpush.h index 35347aaa0a..7ee2e1bf85 100644 --- a/streaming/rrdpush.h +++ b/streaming/rrdpush.h @@ -249,7 +249,7 @@ struct sender_state { size_t not_connected_loops; // Metrics are collected asynchronously by collector threads calling rrdset_done_push(). This can also trigger // the lazy creation of the sender thread - both cases (buffer access and thread creation) are guarded here. - netdata_mutex_t mutex; + SPINLOCK spinlock; struct circular_buffer *buffer; char read_buffer[PLUGINSD_LINE_MAX + 1]; ssize_t read_len; @@ -296,6 +296,9 @@ struct sender_state { } atomic; }; +#define sender_lock(sender) spinlock_lock(&(sender)->spinlock) +#define sender_unlock(sender) spinlock_unlock(&(sender)->spinlock) + #define rrdpush_sender_pipe_has_pending_data(sender) __atomic_load_n(&(sender)->atomic.pending_data, __ATOMIC_RELAXED) #define rrdpush_sender_pipe_set_pending_data(sender) __atomic_store_n(&(sender)->atomic.pending_data, true, __ATOMIC_RELAXED) #define rrdpush_sender_pipe_clear_pending_data(sender) __atomic_store_n(&(sender)->atomic.pending_data, false, __ATOMIC_RELAXED) |