Skip to content

Commit

Permalink
aggregator: reduce splay to just a bunch of seconds
Browse files Browse the repository at this point in the history
When large expiry windows are used, using a splay of up to a window is
just overkill.  We just want to avoid emptying all buckets at once, but
in the end, a little splay here should be enough.  If we really need to
stretch it out over the entire expiry windows, it means we're at max
capacity, and any random mishap, may go over the limit.

Closes: #435
Signed-off-by: Fabian Groffen <grobian@gentoo.org>
  • Loading branch information
grobian committed Apr 27, 2024
1 parent fbd8ea0 commit 9a4321d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions aggregator.c
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,13 @@ aggregator_putmetric(
* requested in issue #72.
* For consistency with other tools/old carbon-aggregator
* align the buckets to interval boundaries such that it is
* predictable what intervals will be taken, issue #104. */
* predictable what intervals will be taken, issue #104.
* Reduce maximum splay to a couple of seconds at most,
* issue #435. */
time(&now);
now = ((now - s->expire) / s->interval) * s->interval;
invocation->expire = s->expire + (rand() % s->interval);
invocation->expire = s->expire +
(rand() % s->interval < 10 ? s->interval : 10);

/* allocate enough buckets to hold the past + future */
invocation->buckets =
Expand Down

0 comments on commit 9a4321d

Please sign in to comment.