Workers are the compute processes that execute your workflow and activity code. They run in your infrastructure, continuously polling Temporal Server for tasks and executing them using the Temporal SDK.
Controls how many workflow tasks can execute simultaneously. Each task runs in its own goroutine/thread.Default: 100
Considerations: Workflow tasks are typically CPU-bound (replay logic). Scale based on CPU cores.
Max Concurrent Activity Tasks
Controls how many activity tasks can execute simultaneously.Default: 100
Considerations: Activities often wait on I/O. Can typically be higher than workflow task concurrency.
Max Concurrent Local Activity Tasks
Controls local activity execution parallelism.Default: 100
Considerations: Local activities execute inline with workflow task, sharing its resources.
type WorkerOptions struct { MaxConcurrentWorkflowTaskPollers int // Number of parallel pollers MaxConcurrentActivityTaskPollers int // Number of parallel pollers WorkflowPollersCount int // Deprecated, use above ActivityPollersCount int // Deprecated, use above // How long to wait for task before considering poll timed out WorkflowTaskTimeout time.Duration // Other options...}
More pollers increases throughput but also increases load on Matching Service. Typical values: 2-10 pollers per worker process.
Each worker has an identity used for observability:
Worker Identity: Unique identifier (hostname + process ID + UUID)
Binary Checksum: Hash of worker binary for detecting bad deployments
Build ID: Worker version for routing workflows to compatible workers
// Server tracks which worker executed each tasktype ActivityInfo struct { StartedIdentity string // Which worker started this attempt RetryLastWorkerIdentity string // Which worker tried last attempt LastWorkerDeploymentVersion *deploymentpb.WorkerDeploymentVersion // ...}
After completing a workflow task, worker keeps workflow state in memory
2
Worker specifies sticky task queue
Response includes a sticky task queue name unique to this worker
3
Next task routed to sticky queue
History Service dispatches next workflow task to sticky queue first
4
Fast path if worker available
Same worker picks up task, skips replay, resumes from cached state
5
Fallback to normal queue
If worker unavailable after timeout, task dispatched to normal queue
Sticky Execution Benefits
Performance: Skip replaying history (can save 100ms+ for large histories)Reduced Server Load: No need to fetch and transmit full historyLower Latency: Workflow tasks complete faster, workflows make progress quickerTradeoff: Workflow execution pinned to specific worker. If worker dies, new worker must do full replay.
Impact: In-flight tasks timeout and retry on other workers. Sticky cache lost, requiring history replay.Mitigation: Workflow tasks automatically redistributed. Minimal impact if worker pool is healthy.
Worker Hangs
Impact: Tasks never complete, timeouts fire, tasks retried elsewhere.Mitigation: Set appropriate workflow task timeout. Monitor task latency.
Network Partition
Impact: Worker can’t reach server, can’t poll for tasks or report results.Mitigation: Workers retry with backoff. Tasks timeout and retry on healthy workers.
Bad Deployment
Impact: All workers deploy broken code, all tasks fail.Mitigation: Binary checksum tracking, gradual rollouts, automated rollback.