[{"content":"# Guides > Build durable multiplayer game sessions with the actor model > Background and best practices\n## Event History and Continue-As-New\n\nEvery Workflow Execution in Temporal produces an append-only Event History. This history has a limit of 51,200 Events or 50 MB. For actor Workflows that run indefinitely, Event History growth must be managed proactively.\n\nContinue-As-New atomically completes the current Workflow Execution and starts a new one with the same Workflow Id, carrying forward any state you provide as arguments. From the perspective of external callers, the Workflow Id remains the same. Signals sent during the transition are not lost; the Temporal Service buffers them for the new execution.\n\nBefore executing Continue-As-New, you must ensure that all in-progress Signal and Update handlers have finished processing. The `workflow.all_handlers_finished` predicate provides this guarantee.","source_url":"https://docs.temporal.io/guides/durable-gaming-sessions.md","page_url":"https://docs.temporal.io/guides/durable-gaming-sessions#event-history-and-continue-as-new"},{"content":"# Develop > Ruby > Workflows\n## Continue-As-New\n\n[Continue-As-New](https://docs.temporal.io/workflow-execution/continue-as-new) enables a Workflow Execution to close successfully and create a new Workflow Execution in a single atomic operation if the number of Events in the Event History is becoming too large.\nThe Workflow Execution spawned from the use of Continue-As-New has the same Workflow Id, a new Run Id, and a fresh Event History and is passed all the appropriate parameters.\n\nAs a precautionary measure, the Workflow Execution's Event History is limited to [51,200 Events](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/common/dynamicconfig/constants.go#L441) or [50 MB](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/common/dynamicconfig/constants.go#L425) and will warn you after 10,240 Events or 10 MB.\n\nTo prevent a Workflow Execution Event History from exceeding this limit and failing, use Continue-As-New to start a new Workflow Execution with a fresh Event History.\n\nA very large Event History can adversely affect the performance of a Workflow Execution.\nFor example, in the case of a Workflow Worker failure, the full Event History must be pulled from the Temporal Service and given to another Worker via a Workflow Task.\nIf the Event history is very large, it may take some time to load it.\n\nThe Continue-As-New feature enables developers to complete the current Workflow Execution and start a new one atomically.\n\nThe new Workflow Execution has the same Workflow Id, but a different Run Id, and has its own Event History.\n\n### Continue-As-New in Ruby\n\nTo Continue-As-New in Ruby, raise a `Temporalio::Workflow::ContinueAsNewError` from inside your Workflow, which will stop the Workflow immediately and Continue-As-New.\n\n[ruby-sandbox/workflows/continue-as-new/continue_as_new_workflow.rb](https://github.com/temporalio/documentation-sdk-code-examples/blob/main/ruby-sandbox/workflows/continue-as-new/continue_as_new_workflow.rb)\n```\nraise Temporalio::Workflow::ContinueAsNewError.new('my-new-arg')\n```\n\n- Temporal *does not* support Continue-as-New functionality within Update handlers.\n- Complete all handlers *before* using Continue-as-New.\n- Use Continue-as-New from your main Workflow Definition method, just as you would complete or fail a Workflow Execution.","source_url":"https://docs.temporal.io/develop/ruby/workflows/continue-as-new.md","page_url":"https://docs.temporal.io/develop/ruby/workflows/continue-as-new"},{"content":"# Best-practices > Worker deployment and performance > Deployment and lifecycle management\n## Manage Event History growth\n\nIf a Worker goes offline and another Worker picks up the same Workflow Execution, the new Worker must replay the\nexisting Event History to resume the Workflow Execution. If the Event History is too large or has too many Events,\nreplay affects the performance of the new Worker and may even cause timeout errors well before the hard limit of 51,200\nEvents is reached.\n\nWe recommend not exceeding a few thousand Events in a single Workflow Execution. The best way to handle Event History\ngrowth is to use the [Continue-As-New](https://docs.temporal.io/workflow-execution/continue-as-new) mechanism to continue under a new Workflow\nExecution with a new Event History, repeating this process as you approach the limits again.\n\nAll Temporal SDKs provide functions to suggest when to use [Continue-As-New](https://docs.temporal.io/workflow-execution/continue-as-new). For\nexample, the Python SDK has the\n[`is_continue_as_new_suggested()`](https://python.temporal.io/temporalio.workflow.html#is_continue_as_new_suggested)\nfunction that returns a `bool` indicating whether to use Continue-As-New.\n\nIn addition to the number of Events, monitor the size of the Event History. Input parameters and output values of both\nWorkflows and Activities are stored in the Event History. Storing large amounts of data can lead to performance\nproblems, so the Temporal Service limits both the size of individual payloads and the total Event History size. A\nWorkflow Execution may be terminated if any single payload exceeds 2 MB or if the entire Event History exceeds 50 MB.\n\nTo avoid hitting these limits, avoid passing large amounts of data into and out of Workflows and Activities. A common\nway to reduce payload and Event History size is the\n[Claim Check](https://dataengineering.wiki/Concepts/Software+Engineering/Claim+Check+Pattern) pattern, widely used with\nmessaging systems such as Apache Kafka. Instead of passing large data into your function, store that data external to\nTemporal in a database or file system. Pass an identifier for the data, such as a primary key or path, into the function\nand use an Activity to retrieve it as needed. If your Activity produces large output, use a similar approach: write the\ndata to an external system and return an identifier that can be used to retrieve it later.","source_url":"https://docs.temporal.io/best-practices/worker.md","page_url":"https://docs.temporal.io/best-practices/worker#manage-event-history-growth"},{"content":"# Workflow-execution > Events and Event History > What is an Event?\n## Event History limits\n\nThe Temporal Service stores the complete Event History for the entire lifecycle of a Workflow Execution.\n\nThe Temporal Service logs a [warning after 10,240 Events](https://docs.temporal.io/workflow-execution/limits) and periodically logs additional warnings as new Events are added.\n\nThe Workflow Execution is terminated when the Event History:\n\n- exceeds 51,200 Events.\n- contains more than 2000 Updates.\n- contains more than 10000 Signals.\n\nTo avoid hitting these limits, you can use the [Continue-As-New](https://docs.temporal.io/workflow-execution/continue-as-new) feature to close the current Workflow Execution and create a new one.","source_url":"https://docs.temporal.io/workflow-execution/event.md","page_url":"https://docs.temporal.io/workflow-execution/event#event-history-limits"},{"content":"# Workflow-execution\n## Workflow Execution limits\n\nThis page discusses [Workflow Execution limits](https://docs.temporal.io/workflow-execution/limits#workflow-execution-limits), [Workflow Execution Callback limits](https://docs.temporal.io/workflow-execution/limits#workflow-execution-callback-limits), and [Nexus Operation limits](https://docs.temporal.io/workflow-execution/limits#workflow-execution-nexus-operation-limits).\n\n### Limits\n\nThere is no limit to the number of concurrent Workflow Executions, albeit you must abide by the Workflow Execution's Event History limit.\n\nAs a precautionary measure, the Workflow Execution's Event History is limited to [51,200 Events](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/common/dynamicconfig/constants.go#L441) or [50 MB](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/common/dynamicconfig/constants.go#L425) and will warn you after 10,240 Events or 10 MB.\n\nThere is also a limit to the number of certain types of incomplete operations.\n\nEach in-progress Activity generates a metadata entry in the Workflow Execution's mutable state.\nToo many entries in a single Workflow Execution's mutable state causes unstable persistence.\nTo protect the system, Temporal enforces a maximum number of incomplete Activities, Child Workflows, Signals, or Cancellation requests per Workflow Execution (by default, 2,000 for each type of operation).\nOnce the limit is reached for a type of operation, if the Workflow Execution attempts to start another operation of that type (by producing a `ScheduleActivityTask`, `StartChildWorkflowExecution`, `SignalExternalWorkflowExecution`, or `RequestCancelExternalWorkflowExecution` Command), it will be unable to (the Workflow Task Execution will fail and get retried).\n\nThese limits are set with the following [dynamic configuration keys](https://github.com/temporalio/temporal/blob/main/service/history/configs/config.go):\n\n- `NumPendingActivitiesLimit`\n- `NumPendingChildExecutionsLimit`\n- `NumPendingSignalsLimit`\n- `NumPendingCancelRequestsLimit`\n\n### Workflow Execution Callback limits\n\nThere is a limit to the total number of Workflow Callbacks that may be attached to a single Workflow Execution.\nAttaching [multiple Nexus callers to a handler Workflow](https://docs.temporal.io/nexus/operations#attaching-multiple-nexus-callers) may exceed this limit.\n\nSet this limit with the [MaxCallbacksPerWorkflow](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/common/dynamicconfig/constants.go#L1082) dynamic configuration key.\n\n### Workflow Execution Nexus Operation Limits\n\nThere is a limit to the maximum number of Nexus Operations in a Workflow before Continue-As-New is required.\nEach in-progress Nexus Operation generates a metadata entry in the Workflow Execution's mutable state.\nToo many entries in a single Workflow Execution's mutable state causes unstable persistence.\nTo protect the system, Temporal enforces a maximum number of incomplete Nexus Operation requests per Workflow Execution (by default, 30 Nexus Operations).\nOnce the limit is reached for a type of operation, if the Workflow Execution attempts to start another Nexus operation (by producing a ScheduleNexusOperation), it will be unable to do so (the Workflow Task Execution will fail and get retried).\n\nThese limits are set with the following [dynamic configuration keys](https://github.com/temporalio/temporal/blob/48dc5a95949ea0e555ce0f48e0031b54633fc703/components/nexusoperations/config.go#L36):\n\n- MaxConcurrentOperations","source_url":"https://docs.temporal.io/workflow-execution/limits.md","page_url":"https://docs.temporal.io/workflow-execution/limits"},{"content":"# Design-patterns\n## Continue-As-New Pattern\n\n### Overview\n\nThe Continue-As-New pattern allows long-running Workflows to reset their event history by completing the current execution and immediately starting a new one with fresh state.\nThis prevents Workflows from hitting Temporal's event history limits while maintaining logical continuity, making it essential for periodic tasks, infinite loops, and Workflows that process unbounded data streams.\nBy archiving old event history and starting fresh, Continue-As-New also reduces active storage costs — only the current execution's history remains in active storage while previous runs are moved to cheaper archived storage.\n\n### Problem\n\nLong-running Workflows — periodic tasks that run indefinitely, infinite loops spanning months or years, or Workflows processing an unbounded stream of data — accumulate Event History with every iteration. Left unchecked, that history eventually hits the 51,200-event limit, and the Workflow still needs to keep its state across whatever comes next.\n\nWithout Continue-As-New, the alternatives are all worse: manually stop and restart Workflows and lose continuity, build external orchestration to manage the Workflow's lifecycle, or accept degraded performance as history grows — and risk failure once it hits the limit.","source_url":"https://docs.temporal.io/design-patterns/continue-as-new.md","page_url":"https://docs.temporal.io/design-patterns/continue-as-new"},{"content":"# Evaluate > Cloud > System limits\n## Programming model level\n\nThe following limits apply at the programming model level.\nSee also: [Self-hosted Temporal Service defaults](https://docs.temporal.io/self-hosted-guide/defaults).\n\n#### Identifier length limit\n\nIdentifiers, such as Workflow Id, Workflow Type, and Task Queue names, are limited to a maximum length of 1,000 bytes.\nNote that Unicode characters may use multiple bytes.\n\n#### Per message gRPC limit\n\nEach gRPC message received has a limit of 4 MB.\nThis limit applies to all gRPC endpoints across the Temporal Platform.\n\n#### Event History transaction size limit\n\nAn Event History transaction encompasses a set of operations such as initiating a new Workflow, scheduling an Activity, processing a Signal, or starting a Child Workflow.\nThese operations create Events that are then logged in the Event History.\nThe transaction size limit restricts the total size of Events that can be accommodated within a single transaction.\n\nThe size limit for any given [Event History](https://docs.temporal.io/workflow-execution/event#event-history) transaction is 4 MB.\nThis limit is non-configurable for Temporal Cloud.\n\n#### Transaction Payload size limit\n\nBlob size limit for Payloads, including Workflow context and each Workflow and Activity argument and return value:\n\n- The max payload for a single request is 2 MB.\n- The max size limit for any given [Event History](https://docs.temporal.io/workflow-execution/event#event-history) transaction is 4 MB.\n\nThis limit is non-configurable for Temporal Cloud.\n\nThe [BlobSizeLimitError guide](https://docs.temporal.io/troubleshooting/blob-size-limit-error) provides solutions for handling large payloads.\n\nThe 2 MB limit is the maximum size for a single request, not a sustained-throughput target.\nSustained, high-volume use of large payloads can degrade Namespace performance, and Temporal reserves the right to rate limit such traffic to protect the service.\nFor workloads that regularly produce large payloads, offload them to [External Storage](https://docs.temporal.io/external-storage) and keep inline payloads small.\n\n#### Per Workflow Execution concurrency limits\n\nIf a Workflow Execution has 2,000 incomplete Activities, Signals, Child Workflows, or external Workflow Cancellation requests, additional [Commands](https://docs.temporal.io/workflow-execution#command) of that type will fail to be applied to that Workflow Execution:\n\n- `ScheduleActivityTask`\n- `SignalExternalWorkflowExecution`\n- `StartChildWorkflowExecution`\n- `RequestCancelExternalWorkflowExecution`\n\nFor optimal performance, limit concurrent operations to 500 or fewer.\nThis reduces Workflow's Event History size and decreases the loading time in the Web UI.\n\n#### Per Workflow Execution Signal limit\n\nA single Workflow Execution may receive up to 10,000 Signals.\nAfter that limit is reached, no more Signals will be processed for that Workflow Execution.\n\nFor sustained traffic, aim for five or fewer Signals per second per Workflow Execution.\nSignals share a lock with other state changes, so throughput depends on persistence latency and the execution's workload.\nFor higher volumes, batch events into each Signal or distribute them across more Workflow Executions.\nSee [Workflow lock contention](https://docs.temporal.io/cloud/service-health#workflow-lock-contention-busyworkflow) to diagnose `BUSY_WORKFLOW` errors.\n\n#### Per Workflow Execution Update limits\n\nA single Workflow Execution can have a maximum of 10 in-flight Updates and 2000 total Updates in History.\n\n#### Workflow Execution Event History limits\n\nAs a precautionary measure, a Workflow Execution's Event History is limited to 51,200 Events or 50 MB.\nIt warns you after 10,240 Events or 10 MB.\nThis limit applies to all Temporal Workflow Executions, whether on Temporal Cloud or other deployments.\n\nThis limit is non-configurable for Temporal Cloud.\n\nRead more about [Temporal Workflow Execution limits](https://docs.temporal.io/workflow-execution/limits) on the [Temporal Workflow](https://docs.temporal.io/workflows) documentation page.","source_url":"https://docs.temporal.io/evaluate/cloud/limits.md","page_url":"https://docs.temporal.io/evaluate/cloud/limits#programming-model-level"},{"content":"# References > Temporal Service dynamic configuration reference > Commonly used dynamic configuration keys\n## Size limit settings\n\nThese keys set size and count limits that protect the Persistence store.\nIf you raise them, provision enough database capacity for the larger values.\n\nFor all platform limits, see [Temporal Platform limits](https://docs.temporal.io/self-hosted-guide/defaults).\n|Dynamic configuration key Type Description Default value| `limit.maxIDLength` Int Maximum length of identifiers and names, including Namespace, Task Queue, Workflow ID, Activity ID, Timer ID, Workflow Type, Activity Type, Signal name, Marker name, failure reason, Identity, and Request ID. 1000| `limit.blobSize.warn` Int Payload size, in bytes, in a single Event at which the Temporal Service logs a warning. 512 KB (512 × 1024)| `limit.blobSize.error` Int Maximum payload size, in bytes, in a single Event. Requests over the limit fail. 2 MB (2 × 1024 × 1024)| `limit.historySize.warn` Int Event History size, in bytes, at which the Temporal Service logs a warning. 10 MB (10 × 1024 × 1024)| `limit.historySize.error` Int Maximum Event History size, in bytes. The Temporal Service terminates a Workflow Execution that exceeds it. 50 MB (50 × 1024 × 1024)| `limit.historyCount.warn` Int Number of Events in an Event History at which the Temporal Service logs a warning. 10,240 Events| `limit.historyCount.error` Int Maximum number of Events in an Event History. The Temporal Service terminates a Workflow Execution that exceeds it. 51,200 Events| `limit.numPendingActivities.error` Int Maximum number of pending Activities a Workflow Execution can have. Further `ScheduleActivityTask` Commands fail. 2000| `limit.numPendingSignals.error` Int Maximum number of pending Signals a Workflow Execution can send to other Workflow Executions. Further `SignalExternalWorkflowExecution` Commands fail. 2000| `history.maximumSignalsPerExecution` Int Maximum number of Signals a Workflow Execution can receive. Further Signals fail with an `InvalidArgument` error. 10000| `limit.numPendingCancelRequests.error` Int Maximum number of pending requests a Workflow Execution can have to cancel other Workflow Executions. Further `RequestCancelExternalWorkflowExecution` Commands fail. 2000| `limit.numPendingChildExecutions.error` Int Maximum number of pending Child Workflows a Workflow Execution can have. Further `StartChildWorkflowExecution` Commands fail. 2000| `frontend.visibilityMaxPageSize` Int Maximum number of Workflow Executions that `ListWorkflowExecutions` returns in one page. 1000 | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | --- | | | ||\n|---|\n\nFor how these limits apply to Commands, see the [Commands reference](https://docs.temporal.io/references/commands).","source_url":"https://docs.temporal.io/references/dynamic-configuration.md","page_url":"https://docs.temporal.io/references/dynamic-configuration#size-limit-settings"}]