[collectd] [PATCH] Random write timeout for rrdtool plugin

Mariusz Gronczewski xani666 at gmail.com
Tue Aug 18 16:02:32 CEST 2009

2009/8/18 Sebastian Harl <sh at tokkee.org>:
> Hi Mariusz,
> On Tue, Aug 18, 2009 at 01:08:30PM +0200, Mariusz Gronczewski wrote:
>> > That's true. However, (unless I'm missing something, didn't have a
>> > coffee yet ;-)) that should only make a difference during start-up -
>> > after some iterations both approaches should behave quite similar,
>> > right?
>> Nope. Because with your approach it works like that
>> 1.Start
>> 2.Pull all (last_value-first_value) >CacheTimeout and push it into write queue
>> 3.At that point last_value=first_value for all cached entries
>> 3.write it at calculated rate to disk
>> So even tho u save them at different time with predefined writes/s, u
>> pull all values from cache at same time so their timeout is
>> "synchronized" with eachother (and still last value will get written
>> in 2*cache timeout). But idea of autotuning writes per sec is nice ;]
> Well, I did not have any implementation details in mind. In fact, I did
> not even look at the 'WritesPerSecond' implementation until right now
> ;-)
>> But when u add random number to Cache Timeout, some of values get
>> pulled bit earlier, some of them will get pulled a bit later and after
>> few cycles it will spread nicely.
>> For your approach to work you would have to pull values from cache and
>> push it to write queue at calculated rate, not push all values to
>> write queue at once and dequeue it at calculated rate.
> Hrm, in fact, I don't think that makes a difference at all. Putting a
> value into the write (or flush) queue does not mean it is removed from
> the cache. Rather, basically, a pointer to the cache entry is stored in
> the queue. (Well, you'd save the memory to store the pointers to the
> cache entries ...) So, while the implementation differs, the behavior
> should be about the same. Am I missing any details you had in mind?

Hmm tbh i thougth it works like on graph
that it moves data from queue to cache, guess i was wrong ;)

> Anyway, I don't see a _real_ disadvantage of your approach either. _I_
> would have used a more "deterministic" approach and I wanted to share my
> two cents about that ;-) I do not oppose to integrate your patch.
And I like idea of self balancing WPS, no more tunning and guessing
;). Just that my idea was easy to implement for me im not very good in
C (i prefer perl for admin things) and it works fine for me :)

More information about the collectd mailing list