# TaskQueueActivitiesPerSecond not working as expected

**URL:** <https://community.temporal.io/t/taskqueueactivitiespersecond-not-working-as-expected/19435>\
**Category:** Community Support\
**Created:** [April 3, 2026, 7:29am UTC](https://community.temporal.io/t/taskqueueactivitiespersecond-not-working-as-expected/19435 "2026-04-03T07:29:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tung\_Le](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tung_le/32/7285_2.png) [@Tung\_Le](https://community.temporal.io/u/Tung_Le)\
**Post date:** [April 3, 2026, 7:29am UTC](https://community.temporal.io/t/taskqueueactivitiespersecond-not-working-as-expected/19435/1 "2026-04-03T07:29:19Z")

</div>

I want to rate limit on a specific activity which is part of a workflow by setting `WorkerOptions.TaskQueueActivitiesPerSecond` to 5. However, when testing with 1,000 workflows, there are instances where the number of activities per second exceeds 5. It typically ranges from 6 to 8 and occurs roughly 10% of the time.

My test setup:

- The activity takes 1-2s to run

- At the start of activity, a timestamp is recorded to calculate activities per second later

Am I missing something or is there anything that I could do to strictly enforce the activities per second limit?

---

<div class="post-metadata">

**Author:** ![tihomir](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tihomir/32/6580_2.png) [@tihomir](https://community.temporal.io/u/tihomir)\
**Post date:** [April 8, 2026, 9:10pm UTC](https://community.temporal.io/t/taskqueueactivitiespersecond-not-working-as-expected/19435/2 "2026-04-08T21:10:46Z")

</div>

This is actually expected, as task queue dispatch rate limiter has a “burst” factor based on number of task queue partitions.

The way you can calculate max burst is using ceiling function for example [here](https://www.omnicalculator.com/math/ceiling-function)

Default number of task queue partitions for a task queue is 4, so

burst-per-partition = ceiling(TaskQueueActivitiesPerSecond/numOfTaskQueuePartitions)  
so for your use case (im assuming you didnt change default num of task queue partitions)  
burst-per-partition = ceiling(5/4) = 2

This means that at time T server can dispatch up to 2 \* numOfTaskQueuePartitions = 8  
activity tasks, and at time T+1 it would not dispatch any so that over time it will maintain 5/s.

If you need very strict dispatch limit (so have to stay at and under 5/s)  
and the throughput of your activities is not extremely high you could lower number of task queue partitions to 1 for this activity task queue via dynamic config, see sample [here](https://github.com/tsurdilo/my-temporal-dockercompose/blob/main/dynamicconfig/development.yaml#L47C1-L66C6)  
this will give you burst of 5 with single partition, so your at your limit.

Alternatively set TaskQueueActivitiesPerSecond to 4 which then would give you burst

burst-per-partition = ceiling(4/4) = 1  
so thats burst of 4 across default num of partitions which will stay under you 5 limit

---

<div class="post-metadata">

**Author:** ![Tung\_Le](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/tung_le/32/7285_2.png) [@Tung\_Le](https://community.temporal.io/u/Tung_Le)\
**Post date:** [April 9, 2026, 2:30am UTC](https://community.temporal.io/t/taskqueueactivitiespersecond-not-working-as-expected/19435/3 "2026-04-09T02:30:17Z")

</div>

Thank you for the detailed answer
