-
Notifications
You must be signed in to change notification settings - Fork 297
Worker Versioning GA Docs Edits #4148
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
bchav
wants to merge
26
commits into
main
Choose a base branch
from
trampolining-upgrade-on-can
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+391
−79
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
9eb35c3
Update worker-versioning.mdx
bchav 9dbb759
Update worker-versioning.mdx
bchav c6d9be6
Add Worker tuning quick reference guide
bchav 4b355b0
fix(worker versioning): fixed merge conflict
flippedcoder e67efc5
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 298f7ad
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 2877729
Update docs/develop/worker-tuning-reference.mdx
flippedcoder ab84838
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 98b1ce6
Update docs/develop/worker-tuning-reference.mdx
flippedcoder c9edeed
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 32189f5
Update docs/develop/worker-tuning-reference.mdx
flippedcoder dfcde11
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 0d22df2
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 016849c
Update docs/develop/worker-tuning-reference.mdx
flippedcoder eff96ed
Update docs/develop/worker-tuning-reference.mdx
flippedcoder c1f3893
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 8513c9e
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 052bcb5
Update docs/develop/worker-tuning-reference.mdx
flippedcoder e17f484
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 43ca3d2
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 3bcba23
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 70b2617
Update docs/develop/worker-tuning-reference.mdx
flippedcoder c54a961
Update docs/develop/worker-tuning-reference.mdx
flippedcoder 7c2e778
chore(worker versioning): added Go code snippet and updated spacing o…
flippedcoder 949ca97
chore(worker versioning): removed CaN references for GA, moving them …
flippedcoder 365e428
fix(worker versioning): fixed missing note character
flippedcoder File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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](/task-queue) in Temporal Cloud or a self-hosted Temporal Service, execute Tasks, and respond with the result. | ||
|
|
||
| ``` | ||
| ┌─────────────────┐ Poll for Tasks ┌──────────────────┐ | ||
| │ - Worker │ ◄─────────────────────── │ Temporal Service │ | ||
| │ - Workflows │ │ │ | ||
| │ - Activities │ ───────────────────────► │ │ | ||
| └─────────────────┘ 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. | ||
|
|
||
| ### 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. | ||
flippedcoder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### 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. | ||
flippedcoder marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| ### 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}`](/references/sdk-metrics#worker_task_slots_available) | | ||
| | `MaxConcurrentActivityTaskExecutionSize` | [`worker_task_slots_available {worker_type = ActivityWorker}`](/references/sdk-metrics#worker_task_slots_available) | | ||
| | `MaxWorkflowThreadCount` | [`workflow_active_thread_count`](/references/sdk-metrics#workflow_active_thread_count) (Java only) | | ||
| | 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`](/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}`](/references/sdk-metrics#num_pollers) | | ||
| | `MaxConcurrentActivityTaskPollers` | [`num_pollers {poller_type = activity_task}`](/references/sdk-metrics#num_pollers) | | ||
| | Network latency | [`request_latency {namespace, operation}`](/references/sdk-metrics#request_latency) | | ||
|
|
||
| ### Task Queue metrics | ||
|
|
||
| | Metric | Description | | ||
| |--------|-------------| | ||
| | [`poll_success_sync_count`](/cloud/metrics/reference#temporal_cloud_v0_poll_success_sync_count) | Sync match rate (Tasks immediately assigned to Workers) | | ||
| | [`approximate_backlog_count`](/cloud/metrics/openmetrics/metrics-reference#temporal_cloud_v1_approximate_backlog_count) | Approximate number of Tasks in a Task Queue | | ||
|
|
||
| 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`](/references/sdk-metrics#long_request_failure) | Failures for long-running operations (polling, history retrieval) | | ||
| | [`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 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.