# Randomising Task Offsets

**URL:** <https://community.influxdata.com/t/randomising-task-offsets/24837>\
**Category:** Tasks\
**Tags:** tasks\
**Created:** [April 28, 2022, 11:25pm UTC](https://community.influxdata.com/t/randomising-task-offsets/24837 "2022-04-28T23:25:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmh](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/cmh/32/10018_2.png) [@cmh](https://community.influxdata.com/u/cmh)\
**Post date:** [April 28, 2022, 11:25pm UTC](https://community.influxdata.com/t/randomising-task-offsets/24837/1 "2022-04-28T23:25:47Z")

</div>

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}`

---

<div class="post-metadata">

**Author:** ![Jay\_Clifford](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/jay_clifford/32/8287_2.png) [@Jay\_Clifford](https://community.influxdata.com/u/Jay_Clifford)\
**Post date:** [April 29, 2022, 9:47am UTC](https://community.influxdata.com/t/randomising-task-offsets/24837/2 "2022-04-29T09:47:13Z")

</div>

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](https://docs.influxdata.com/influxdb/cloud/process-data/task-options/#:~:text=task%20%3D%20%7B%0A%20%20%20%20//%20...%0A%20%20%20%20offset%3A%2010m%2C%0A%7D-,concurrency,-The%20number%20task):

```auto
option task = {
    // ...
    concurrency: 2,
}

```

@Anaisdg is there anything else they could do here?

---

<div class="post-metadata">

**Author:** ![Anaisdg](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/anaisdg/32/6401_2.png) [@Anaisdg](https://community.influxdata.com/u/Anaisdg)\
**Post date:** [April 29, 2022, 7:00pm UTC](https://community.influxdata.com/t/randomising-task-offsets/24837/3 "2022-04-29T19:00:00Z")

</div>

@Jay_Clifford spot on 🙂

---

<div class="post-metadata">

**Author:** ![cmh](https://sea1.discourse-cdn.com/flex023/user_avatar/community.influxdata.com/cmh/32/10018_2.png) [@cmh](https://community.influxdata.com/u/cmh)\
**Post date:** [May 2, 2022, 8:46pm UTC](https://community.influxdata.com/t/randomising-task-offsets/24837/4 "2022-05-02T20:46:55Z")

</div>

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.
