Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/develop/worker-performance.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -846,5 +846,6 @@ If, after adjusting the poller and executors count as specified earlier, you sti

## Related reading

- [Worker tuning quick reference](/develop/worker-tuning-reference) - SDK defaults and metrics by resource type
- [Workers in production operation guide](https://temporal.io/blog/workers-in-production)
- [Full set of SDK Metrics reference](/references/sdk-metrics)
215 changes: 215 additions & 0 deletions docs/develop/worker-tuning-reference.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,215 @@
---
id: worker-tuning-reference
title: Worker tuning quick reference
sidebar_label: Worker tuning reference
description: A quick reference guide for Temporal Worker configuration defaults across SDKs, organized by resource type (compute, memory, IO) with key metrics for each.
toc_max_heading_level: 4
keywords:
- worker tuning
- worker configuration
- sdk defaults
- worker metrics
- performance
tags:
- Workers
- Performance
- Reference
---

This page provides a quick reference for Worker configuration options and their default values across Temporal SDKs.
Use this guide alongside the comprehensive [Worker performance](/develop/worker-performance) documentation for detailed tuning guidance.

Worker performance is constrained by three primary resources:

| Resource | Description |
|----------|-------------|
| **Compute** | CPU-bound operations, concurrent Task execution |
| **Memory** | Workflow cache, thread pools |
| **IO** | Network calls to Temporal Service, polling |

## How a Worker works

Workers poll a [Task Queue](/workers#task-queues) in Temporal Cloud or a self-hosted Temporal Service, execute Tasks, and respond with the result.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Workers poll a [Task Queue](/workers#task-queues) in Temporal Cloud or a self-hosted Temporal Service, execute Tasks, and respond with the result.
Workers poll a [Task Queue](/task-queue) in Temporal Cloud or a self-hosted Temporal Service, execute Tasks, and respond with the result.


```
┌─────────────────┐ Poll for Tasks ┌─────────────────┐
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
┌─────────────────┐ Poll for Tasks ┌─────────────────┐
┌─────────────────┐ Poll for Tasks ┌─────────────────

│ Worker │ ◄─────────────────────── │ Temporal Service│
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Worker │ ◄─────────────────────── │ Temporal Service│
- Worker │ ◄─────────────────────── │ Temporal Service

│ - Workflows │ │ │
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
│ - Workflows │ │ │
│ - Workflows │ │

│ - Activities │ ─────────────────────► │ │
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
│ - Activities │ ─────────────────────► │
│ - Activities │ ───────────────────────► │

└─────────────────┘ Respond with results └─────────────────┘
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
└─────────────────┘ Respond with results └─────────────────┘
└─────────────────┘ Respond with results └─────────────────

```

Multiple Workers can poll the same Task Queue, providing horizontal scalability.

### How Worker failure recovery works

When a Worker crashes or experiences a host outage:

1. The Workflow Task times out
2. Another available Worker picks up the Task
3. The new Worker replays the Event History to reconstruct state
4. Execution continues from where it left off

For more details on Worker architecture, see [What is a Temporal Worker?](/workers)

## Compute settings

Compute settings control how many Tasks a Worker can execute concurrently.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can the compute defaults be changed? The dynamic config? If they can be changed, add a link to where that happens.


### Compute configuration options

| Setting | Description |
|---------|-------------|
| `MaxConcurrentWorkflowTaskExecutionSize` | Maximum concurrent Workflow Tasks |
| `MaxConcurrentActivityTaskExecutionSize` | Maximum concurrent Activity Tasks |
| `MaxConcurrentLocalActivityTaskExecutionSize` | Maximum concurrent Local Activities |
| `MaxWorkflowThreadCount` / `workflowThreadPoolSize` | Thread pool for Workflow execution |

### Compute defaults by SDK

| SDK | MaxConcurrentWorkflowTaskExecutionSize | MaxConcurrentActivityTaskExecutionSize | MaxConcurrentLocalActivityTaskExecutionSize | MaxWorkflowThreadCount |
|-----|----------------------------------------|----------------------------------------|---------------------------------------------|------------------------|
| **Go** | 1,000 | 1,000 | 1,000 | - |
| **Java** | 200 | 200 | 200 | 600 |
| **TypeScript** | 40 | 100 | 100 | 1 (reuseV8Context) |
| **Python** | 100 | 100 | 100 | - |
| **.NET** | 100 | 100 | 100 | - |

### Resource-based slot suppliers

Instead of fixed slot counts, you can use resource-based slot suppliers that automatically adjust available Task slots based on CPU and memory utilization.
For implementation details, see [Slot suppliers](/develop/worker-performance#slot-suppliers).

## Memory settings

Memory settings control the Workflow cache size and thread pool allocation.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can the memory defaults be changed? The dynamic config? If they can be changed, add a link to where that happens.


### Memory configuration options

| Setting | Description |
|---------|-------------|
| `MaxCachedWorkflows` / `StickyWorkflowCacheSize` | Number of Workflows to keep in cache |
| `MaxWorkflowThreadCount` | Thread pool size |
| `reuseV8Context` (TypeScript) | Reuse V8 context for Workflows |

### Memory defaults by SDK

| SDK | MaxCachedWorkflows / StickyWorkflowCacheSize |
|-----|----------------------------------------------|
| **Go** | 10,000 |
| **Java** | 600 |
| **TypeScript** | Dynamic (e.g., 2000 for 4 GiB RAM) |
| **Python** | 1,000 |
| **.NET** | 10,000 |

For cache tuning guidance, see [Workflow cache tuning](/develop/worker-performance#workflow-cache-tuning).

## IO settings

IO settings control the number of pollers and rate limits for Task Queue interactions.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where can the IO defaults be changed? The dynamic config? If they can be changed, add a link to where that happens.


### IO configuration options

| Setting | Description |
|---------|-------------|
| `MaxConcurrentWorkflowTaskPollers` | Number of concurrent Workflow pollers |
| `MaxConcurrentActivityTaskPollers` | Number of concurrent Activity pollers |
| `Namespace APS` | Actions per second limit for Namespace |
| `TaskQueueActivitiesPerSecond` | Activity rate limit per Task Queue |

### IO defaults by SDK

| SDK | MaxConcurrentWorkflowTaskPollers | MaxConcurrentActivityTaskPollers | Namespace APS | TaskQueueActivitiesPerSecond |
|-----|----------------------------------|----------------------------------|---------------|------------------------------|
| **Go** | 2 | 2 | 400 | Unlimited |
| **Java** | 5 | 5 | - | - |
| **TypeScript** | 10 | 10 | - | - |
| **Python** | 5 | 5 | - | - |
| **.NET** | 5 | 5 | - | - |

### Poller autoscaling

Use poller autoscaling to automatically adjust the number of concurrent polls based on workload.
For configuration details, see [Configuring poller options](/develop/worker-performance#configuring-poller-options).

## Metrics reference by resource type

Use these metrics to identify bottlenecks and guide tuning decisions.
For the complete metrics reference, see [SDK metrics](/references/sdk-metrics).

### Compute-related metrics

| Worker configuration option | SDK metric |
|-----------------------------|------------|
| `MaxConcurrentWorkflowTaskExecutionSize` | `worker_task_slots_available {worker_type = WorkflowWorker}` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `MaxConcurrentWorkflowTaskExecutionSize` | `worker_task_slots_available {worker_type = WorkflowWorker}` |
| `MaxConcurrentWorkflowTaskExecutionSize` | [`worker_task_slots_available {worker_type = WorkflowWorker}`](/references/sdk-metrics#worker_task_slots_available) |

| `MaxConcurrentActivityTaskExecutionSize` | `worker_task_slots_available {worker_type = ActivityWorker}` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `MaxConcurrentActivityTaskExecutionSize` | `worker_task_slots_available {worker_type = ActivityWorker}` |
| `MaxConcurrentActivityTaskExecutionSize` | [`worker_task_slots_available {worker_type = ActivityWorker}`](/references/sdk-metrics#worker_task_slots_available) |

| `MaxWorkflowThreadCount` | `workflow_active_thread_count` (Java only) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `MaxWorkflowThreadCount` | `workflow_active_thread_count` (Java only) |
| `MaxWorkflowThreadCount` | [`workflow_active_thread_count`](/references/sdk-metrics#workflow_active_thread_count) (Java only) |

| CPU-intensive logic | `workflow_task_execution_latency` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| CPU-intensive logic | `workflow_task_execution_latency` |
| CPU-intensive logic | [`workflow_task_execution_latency`](/references/sdk-metrics#workflow_task_execution_latency) |


Also monitor your machine's CPU consumption (for example, `container_cpu_usage_seconds_total` in Kubernetes).

### Memory-related metrics

| Worker configuration option | SDK metric |
|-----------------------------|------------|
| `StickyWorkflowCacheSize` | `sticky_cache_total_forced_eviction`, `sticky_cache_size`, `sticky_cache_hit`, `sticky_cache_miss` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `StickyWorkflowCacheSize` | `sticky_cache_total_forced_eviction`, `sticky_cache_size`, `sticky_cache_hit`, `sticky_cache_miss` |
| `StickyWorkflowCacheSize` | [`sticky_cache_total_forced_eviction`](/references/sdk-metrics#sticky_cache_total_forced_eviction), [`sticky_cache_size`](/references/sdk-metrics#sticky_cache_size), [`sticky_cache_hit`](/references/sdk-metrics#sticky_cache_hit), [`sticky_cache_miss`](/references/sdk-metrics#sticky_cache_miss) |


Also monitor your machine's memory consumption (for example, `container_memory_usage_bytes` in Kubernetes).

### IO-related metrics

| Worker configuration option | SDK metric |
|-----------------------------|------------|
| `MaxConcurrentWorkflowTaskPollers` | `num_pollers {poller_type = workflow_task}` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `MaxConcurrentWorkflowTaskPollers` | `num_pollers {poller_type = workflow_task}` |
| `MaxConcurrentWorkflowTaskPollers` | [`num_pollers {poller_type = workflow_task}`](/references/sdk-metrics#num_pollers) |

| `MaxConcurrentActivityTaskPollers` | `num_pollers {poller_type = activity_task}` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `MaxConcurrentActivityTaskPollers` | `num_pollers {poller_type = activity_task}` |
| `MaxConcurrentActivityTaskPollers` | [`num_pollers {poller_type = activity_task}`](/references/sdk-metrics#num_pollers) |

| Network latency | `request_latency {namespace, operation}` |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| Network latency | `request_latency {namespace, operation}` |
| Network latency | [`request_latency {namespace, operation}`](/references/sdk-metrics#request_latency) |


### Task Queue metrics

| Metric | Description |
|--------|-------------|
| `poll_success_sync_count` | Sync match rate (Tasks immediately assigned to Workers) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `poll_success_sync_count` | Sync match rate (Tasks immediately assigned to Workers) |
| [`poll_success_sync_count`](/cloud/metrics/reference#temporal_cloud_v0_poll_success_sync_count) | Sync match rate (Tasks immediately assigned to Workers) |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look and make sure I'm linking to the same thing you're describing here.

| `approximate_backlog_count` | Approximate number of Tasks in a Task Queue |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `approximate_backlog_count` | Approximate number of Tasks in a Task Queue |
| [`approximate_backlog_count`](/cloud/metrics/openmetrics/metrics-reference#temporal_cloud_v1_approximate_backlog_count) | Approximate number of Tasks in a Task Queue |

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Take a look and make sure I'm linking to the same thing you're describing here.


Task Queue statistics are also available via the `DescribeTaskQueue` API:
- `ApproximateBacklogCount`
- `ApproximateBacklogAge`
- `TasksAddRate`
- `TasksDispatchRate`
- `BacklogIncreaseRate`

For more on Task Queue metrics, see [Available Task Queue information](/develop/worker-performance#task-queue-metrics).

### Failure metrics

| Metric | Description |
|--------|-------------|
| `long_request_failure` | Failures for long-running operations (polling, history retrieval) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `long_request_failure` | Failures for long-running operations (polling, history retrieval) |
| [`long_request_failure`](/references/sdk-metrics#long_request_failure) | Failures for long-running operations (polling, history retrieval) |

| `request_failure` | Failures for standard operations (Task completion responses) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| `request_failure` | Failures for standard operations (Task completion responses) |
| [`request_failure`](/references/sdk-metrics#request_failure) | Failures for standard operations (Task completion responses) |


Common failure codes:
- `RESOURCE_EXHAUSTED` - Rate limits exceeded
- `DEADLINE_EXCEEDED` - Operation timeout
- `NOT_FOUND` - Resource not found

## Worker tuning tips

1. **Scale test before production**: Validate your configuration under realistic load.
2. **Infrastructure matters**: Workers don't operate in a vacuum. Consider network latency, database performance, and external service dependencies.
3. **Tune and observe**: Make incremental changes and monitor metrics before making additional adjustments.
4. **Identify the bottleneck**: Use the [theory of constraints](https://en.wikipedia.org/wiki/Theory_of_constraints). Improving non-bottleneck resources won't improve overall throughput.

For detailed tuning guidance, see:
- [Worker performance](/develop/worker-performance)
- [Worker deployment and performance best practices](/best-practices/worker)
- [Performance bottlenecks troubleshooting](/troubleshooting/performance-bottlenecks)

## Related resources

- [What is a Temporal Worker?](/workers) - Conceptual overview
- [Worker performance](/develop/worker-performance) - Comprehensive tuning guide
- [Worker deployment and performance](/best-practices/worker) - Best practices
- [SDK metrics reference](/references/sdk-metrics) - Complete metrics documentation
- [Worker Versioning](/production-deployment/worker-deployments/worker-versioning) - Safe deployments
- [Workers in production](https://temporal.io/blog/workers-in-production) - Blog post
- [Introduction to Worker Tuning](https://temporal.io/blog/an-introduction-to-worker-tuning) - Blog post
1 change: 1 addition & 0 deletions docs/encyclopedia/workers/workers.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Therefore, a single Worker can handle millions of open Workflow Executions, assu
**Operation guides:**

- [How to tune Workers](/develop/worker-performance)
- [Worker tuning quick reference](/develop/worker-tuning-reference) - SDK defaults and metrics

## What is a Worker Identity? {#worker-identity}

Expand Down
Loading