# Rate limiting task queues and workers

**URL:** <https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296>\
**Category:** Community Support\
**Tags:** general-impl\
**Created:** [July 27, 2020, 8:53pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296 "2020-07-27T20:53:23Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jacques\_Thomas](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jacques_thomas/32/64_2.png) [@Jacques\_Thomas](https://community.temporal.io/u/Jacques_Thomas)\
**Post date:** [July 27, 2020, 8:53pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/1 "2020-07-27T20:53:23Z")

</div>

Hi, where can I read more about the options for rate limiting?

I am interested in:

- rate limiting at the task queue level
- rate limiting at the worker level

My understanding is that both are possible, but I must be missing something obvious.

Thank you,  
Jacques

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [July 27, 2020, 9:06pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/2 "2020-07-27T21:06:37Z")

</div>

Just noticed that there is a property with a different name across Java and Go SDKs:

## Java SDK

Use WorkerOptions properties to configure.

- maxActivitiesPerSecond - worker specific rate limit
- maxConcurrentActivityExecutionSize - worker specific limit on number of parallel activities
- taskQueueActivitiesPerSecond - global task queue limit across all the workers

## Go SDK

Use WorkerOptions properties to configure

- WorkerActivitiesPerSecond - worker specific rate limit
- MaxConcurrentActivityExecutionSize - worker specific limit on number of parallel activities
- TaskQueueActivitiesPerSecond - global task queue limit across all the workers

---

<div class="post-metadata">

**Author:** ![Jacques\_Thomas](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/jacques_thomas/32/64_2.png) [@Jacques\_Thomas](https://community.temporal.io/u/Jacques_Thomas)\
**Post date:** [July 27, 2020, 9:29pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/3 "2020-07-27T21:29:41Z")

</div>

This is exactly what I was looking for. Thank you Max!

---

<div class="post-metadata">

**Author:** ![Gordon\_Bean](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_bean/32/224_2.png) [@Gordon\_Bean](https://community.temporal.io/u/Gordon_Bean)\
**Post date:** [October 22, 2020, 5:00pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/4 "2020-10-22T17:00:19Z")

</div>

Is the following configuration possible?

I have a worker that will run on special hardware (FPGA enabled). That worker can either do jobs of type A or B; however, it can only do one A job at a time, but it can do 10 B jobs at a time. The worker should only process jobs of one type at a time (i.e. no concurrent jobs of A and B on the same node).

How would this be configured?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 22, 2020, 5:16pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/5 "2020-10-22T17:16:00Z")

</div>

With such requirements wouldn’t it lead to full starvation of job A?

---

<div class="post-metadata">

**Author:** ![Gordon\_Bean](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/gordon_bean/32/224_2.png) [@Gordon\_Bean](https://community.temporal.io/u/Gordon_Bean)\
**Post date:** [October 22, 2020, 5:42pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/6 "2020-10-22T17:42:06Z")

</div>

A given workflow will have several tasks to accomplish, with a blend of types A and B. There will be dedicated activity queues for a single workflow, but only one worker node. I’m want to get a feel for how to run B jobs in parallel while ensuring A jobs run serially.

So there is a finite number of jobs that will ever go into the tasks queues.

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [October 22, 2020, 5:44pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/7 "2020-10-22T17:44:16Z")

</div>

If you have only one workflow execution (instance) using that worker then I would implement all the logic in the workflow itself. It has full control over which activities are scheduled and at which point.

---

<div class="post-metadata">

**Author:** ![akd](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/akd/32/4437_2.png) [@akd](https://community.temporal.io/u/akd)\
**Post date:** [November 4, 2021, 8:58pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/8 "2021-11-04T20:58:32Z")

</div>

> - taskQueueActivitiesPerSecond - global task queue limit across all the workers

It’s probably the most practical to set task queue configuration on the worker level, since they are most closely coupled, but it seems odd for a single worker to be able to dictate the queue’s behavior.

What happens if 2 workers polling from the same queue set different values for `taskQueueActivitiesPerSecond`?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [November 5, 2021, 3:01pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/9 "2021-11-05T15:01:00Z")

</div>

> It’s probably the most practical to set task queue configuration on the worker level, since they are most closely coupled, but it seems odd for a single worker to be able to dictate the queue’s behavior.

We realize this and might add the ability to configure task queues through some admin APIs.

> What happens if 2 workers polling from the same queue set different values for `taskQueueActivitiesPerSecond` ?

I believe the lowest value will be used. It is done to support updates to the value during worker deployments.

---

<div class="post-metadata">

**Author:** ![Bo\_Gao](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/bo_gao/32/887_2.png) [@Bo\_Gao](https://community.temporal.io/u/Bo_Gao)\
**Post date:** [November 17, 2021, 12:00am UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/10 "2021-11-17T00:00:45Z")

</div>

> [@maxim](#):
>
> TaskQueueActivitiesPerSecond

Facing higher activity per sec load, will the behavior throttling those activities or save them for later process using the max rate?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [November 17, 2021, 2:33am UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/11 "2021-11-17T02:33:28Z")

</div>

They will be saved in the task queue for later processing.

---

<div class="post-metadata">

**Author:** ![carrotcap3](https://avatars.discourse-cdn.com/v4/letter/c/8e8cbc/32.png) [@carrotcap3](https://community.temporal.io/u/carrotcap3)\
**Post date:** [February 15, 2022, 8:41pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/12 "2022-02-15T20:41:30Z")

</div>

Do I need to delete the task queue for these changes to take affect? I made changes but I am not seeing the rate limiting take affect

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [February 16, 2022, 5:45pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/13 "2022-02-16T17:45:16Z")

</div>

No, task rate limiting is dynamic and can be updated any time by the worker.

---

<div class="post-metadata">

**Author:** ![Dileep\_Pandiya](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/dileep_pandiya/32/2536_2.png) [@Dileep\_Pandiya](https://community.temporal.io/u/Dileep_Pandiya)\
**Post date:** [September 12, 2022, 7:46pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/14 "2022-09-12T19:46:39Z")

</div>

Hi All,

In my case have multiple worker reading from task queue concurrently can i still use **taskQueueActivitiesPerSecond** for setting up global task queue limit for workflows .?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [September 12, 2022, 7:51pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/15 "2022-09-12T19:51:53Z")

</div>

**taskQueueActivitiesPerSecond** is global across all workers polling on the task queue. Note that it applies to activities only, not workflows.

---

<div class="post-metadata">

**Author:** ![Dileep\_Pandiya](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/dileep_pandiya/32/2536_2.png) [@Dileep\_Pandiya](https://community.temporal.io/u/Dileep_Pandiya)\
**Post date:** [September 12, 2022, 8:20pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/16 "2022-09-12T20:20:14Z")

</div>

Do we have anything we can similarly apply to workflows .?

---

<div class="post-metadata">

**Author:** ![maxim](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/maxim/32/8_2.png) [@maxim](https://community.temporal.io/u/maxim)\
**Post date:** [September 12, 2022, 9:19pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/17 "2022-09-12T21:19:58Z")

</div>

What are you trying to achieve? What is the use case for limiting the workflow execution rate?

---

<div class="post-metadata">

**Author:** ![Dileep\_Pandiya](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/dileep_pandiya/32/2536_2.png) [@Dileep\_Pandiya](https://community.temporal.io/u/Dileep_Pandiya)\
**Post date:** [September 12, 2022, 10:03pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/18 "2022-09-12T22:03:20Z")

</div>

So our workflows making calls to others services and we need to make call the these services within service limit. And i would like to handle this configuration at workflow level. In future planning to have multiple workflows which will handle different job  
So

1. Can keep a global setting for a workflow rate limiting
2. Configure Different workflows with different rate limiting settlings.

---

<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:** [September 12, 2022, 10:47pm UTC](https://community.temporal.io/t/rate-limiting-task-queues-and-workers/296/19 "2022-09-12T22:47:02Z")

</div>

> we need to make call the these services within service limit

You would need to make these 3rd party service calls from within activity code, think in this case rate limiting activities (and setting activity timeout options per your business needs) would still be what you need imo.
