Randomising Task Offsets

I’m wondering if it’s possible to randomise the offset for tasks within some window. We have a lot of tasks running at a 5m interval and they all kick off at exactly the same time. It seems to me that spreading these tasks out across a 1m window would ease load on the server during these calculations. I suppose it would be possible to hard code different offsets for each task to spread them out, but it would be a lot of maintenance to manage as tasks are added or removed over time. Something like this would be much easier:

option task = {name: "downsample-cpu", every: 5m, offset: 5s, offset_fuzz: 1m}

1 Like

Hi @cmh,
Great feature request, perhaps you could submit an issue on the InfluxDB repo. Until then I can see perhaps two workarounds.

  1. Create the tasks using the CLI / REST API via a bash script. Then insert a random interval between a range.
  2. Potentially you could also experiment with concurrency:
option task = {
    // ...
    concurrency: 2,
}

@Anaisdg is there anything else they could do here?

1 Like

@Jay_Clifford spot on :slight_smile:

It isn’t clear from the documentation exactly what setting concurrency does. Does concurrency: 2 mean that at most 2 instances of this task will run in concurrently or that this task will only run when 1 (2 - 1) other task (any task) is running? If it’s the former I don’t think this would help in this case at all. If the latter it would obviously have to be set on all tasks.