Number of initialised workers vs actual workers are different in temporal cloud

Hey folks,

I’m trying to understand how Temporal workers function under the hood.

I have three workers, each assigned to a different task queue. But when I check the history while debugging, only two seem to be handling activities, and they sometimes switch between task queues.

In another case,
I noticed workers = 5, even though my code only initializes 2. Any idea why?

Appreciate any insights! :folded_hands:

and they sometimes switch between task queues

Single worker can poll only on single task queue. Can you give more insight into what you are seeing?

when I check the history while debugging, only two seem to be handling activities

Do any of your workflows schedule activities on task queue of worker which you see is not handling activity tasks? Does that worker have activities registered (if not it would not poll for activity tasks)

I noticed workers = 5, even though my code only initializes 2. Any idea why?

Are you seeing that via DescribeTaskQueue api or in UI when clicking on the taskqueue info link? Note that this api is a 2 min sliding window type of api, so if you restarted your workers you would still see the old ones in results for up to 2 mins from when they are shut down.