How do worker processes keep track of spare capacity?

Hello! I’m thinking about using Temporal for work distribution (load balancing) for long-running, asynchronous activities that need to do a fair bit of processing (external data ingestion, transformation, and storage). Temporal isn’t necessarily a perfect fit for this use-case, but the task queue concept in Temporal provides a very attractive set of primitives that would eliminate a significant portion of our implementation.

I have a specific question about the task queue documentation on this page: Tasks | Temporal Documentation

A Worker Processes polls for a message only when it has spare capacity, avoiding overloading itself.

Can you please expand more on “spare capacity”; is this simply referring to the worker knowing how many tasks are in-flight (e.g. it understand limits defined such as How to set WorkerOptions in Go | Temporal Documentation), or is there more going on here? How does the worker limit itself to avoid overloading?

By spare capacity the documentation indeed means limits defined through WorkerOptions. These are the number of activities a worker is allowed to execute in parallel and the rate limit of their execution.

For your use case, the best match is Session. The session provides a way to execute multiple activities at the same worker process or host. It is possible to limit the number of parallel sessions per host. Unfortunately, the session feature currently is available only in Go SDK.