# Worker processes with multiple worker entities polling on different queues

**URL:** <https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673>\
**Category:** Community Support\
**Tags:** go-sdk\
**Created:** [June 28, 2023, 10:19am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673 "2023-06-28T10:19:14Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.temporal.io/u/karthik)\
**Post date:** [June 28, 2023, 10:19am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/1 "2023-06-28T10:19:14Z")

</div>

I need a worker to listen to two queues so that I can throttle them. There were no examples of how I can run two worker entities in a single worker process. On the [worker docs page](https://docs.temporal.io/workers#worker-process) it says:

```auto
A single Worker Entity can listen to only a single Task Queue. But if a Worker Process has multiple Worker Entities, the Worker Process could be listening to multiple Task Queues.

```

This is how I have set it up now, but not sure if that’s the right way to do it.

func main() {  
&nbsp;&nbsp;&nbsp;&nbsp; …  
&nbsp;&nbsp;&nbsp;&nbsp; …  
&nbsp;&nbsp;&nbsp;&nbsp; err = w.Start()  
&nbsp;&nbsp;&nbsp;&nbsp; err2 := w2.Start()  
&nbsp;&nbsp;&nbsp;&nbsp; if err != nil {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.Fatal(“Unable to start worker”, err)  
&nbsp;&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp;&nbsp; if err2 != nil {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; logger.Fatal(“Unable to start worker”, err2)  
&nbsp;&nbsp;&nbsp;&nbsp; }  
&nbsp;&nbsp;&nbsp;&nbsp; \<-worker.InterruptCh()  
}

---

<div class="post-metadata">

**Author:** ![antonio.perez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/antonio.perez/32/2417_2.png) [@antonio.perez](https://community.temporal.io/u/antonio.perez)\
**Post date:** [June 28, 2023, 11:51am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/2 "2023-06-28T11:51:06Z")

</div>

Hello @karthik

The code you have shared will start two workers within the same process and as you have mentioned you can have those workers listening on different taskqueues.

> I need a worker to listen to two queues so that I can throttle them

Can you elaborate on this? sorry I don’t understand how this is related to having two workers in the same process,

Antonio

---

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.temporal.io/u/karthik)\
**Post date:** [June 28, 2023, 11:56am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/3 "2023-06-28T11:56:41Z")

</div>

Sorry about this

```auto
I need a worker to listen to two queues so that I can throttle them

```

I meant a worker process with two worker entities listening to two queues.  
Just to clarify the terminology here, the two workers I have started in the code, are they the worker entities? and the process running these two is the worker process?

One follow up question:

If I have two workers in the process with each listening on their own queues, I am assuming if I set MaxConcurrentActivityExecutionSize and TaskQueueActivitiesPerSecond for one of the workers to half of what it is set to the other worker, I will see an increase in throughput from the queue that has the higher MaxConcurrentActivityExecutionSize and TaskQueueActivitiesPerSecond?

---

<div class="post-metadata">

**Author:** ![antonio.perez](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/antonio.perez/32/2417_2.png) [@antonio.perez](https://community.temporal.io/u/antonio.perez)\
**Post date:** [June 28, 2023, 1:05pm UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/4 "2023-06-28T13:05:07Z")

</div>

> [@](#):
>
> Just to clarify the terminology here, the two workers I have started in the code, are they the worker entities? and the process running these two is the worker process?

yes, that is what I understand.

> [@](#):
>
> If I have two workers in the process with each listening on their own queues, I am assuming if I set MaxConcurrentActivityExecutionSize and TaskQueueActivitiesPerSecond for one of the workers to half of what it is set to the other worker, will I see an increase in throughput from the queue that has the higher MaxConcurrentActivityExecutionSize and TaskQueueActivitiesPerSecond?

I would say it depends. are activities placed in both taskqueues consuming the same amount of resources, same end-to-end latency etc…

Note that they are two different things with two different proposes:

- [MaxConcurrentActivityExecutionSize](https://legacy-documentation-sdks.temporal.io/go/how-to-set-workeroptions-in-go#maxconcurrentactivityexecutionsize) will limit the number of concurrent execution on the worker side. It is usually used for worker performance tunning, eg. to limit the CPU utilization.  
See [Developer's guide - Worker performance | Temporal Documentation](https://docs.temporal.io/dev-guide/worker-performance#worker-executor-slots-sizing)

- [TaskQueueActivitiesPerSecond](https://legacy-documentation-sdks.temporal.io/go/how-to-set-workeroptions-in-go#taskqueueactivitiespersecond) is shared across all workers listening in the same taskqueue. It is usually used to rate limit the invocation to an external service (request per second) by the activity/es running in the queue. The server controls the frequency activity tasks are delivered to the workers.

---

<div class="post-metadata">

**Author:** ![karthik](https://avatars.discourse-cdn.com/v4/letter/k/9fc348/32.png) [@karthik](https://community.temporal.io/u/karthik)\
**Post date:** [June 29, 2023, 9:44am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/5 "2023-06-29T09:44:04Z")

</div>

Thanks @antonio.perez . That is what I was looking for

---

<div class="post-metadata">

**Author:** ![Dharma-Priya1.1](https://avatars.discourse-cdn.com/v4/letter/d/977dab/32.png) [@Dharma-Priya1.1](https://community.temporal.io/u/Dharma-Priya1.1)\
**Post date:** [May 23, 2024, 10:15am UTC](https://community.temporal.io/t/worker-processes-with-multiple-worker-entities-polling-on-different-queues/8673/6 "2024-05-23T10:15:01Z")

</div>

Hi, Just wanted to see if this is achievable in ruby-sdk? I tried starting the 2 workers but until the first worker is terminated the temporal **ruby-sdk** doesn’t allow to start the second worker entity under the same worker process.

How can we achieve this worker process polling with worker entities on different queues in ruby-sdk?
