Troubleshoot the blob size limit error
The BlobSizeLimitError
is an error that occurs when the size of a blob (payloads including Workflow context and each Workflow and Activity argument and return value) exceeds the set limit in Temporal.
- The max payload for a single request is 2 MB.
- The max size limit for any given Event History transaction is 4 MB.
Why does this error occur?
This error occurs when the size of the blob exceeds the maximum size allowed by Temporal.
This limit helps ensure that the Temporal Service prevents excessive resource usage and potential performance issues when handling large payloads.
How do I resolve this error?
To resolve this error, reduce the size of the blob so that it is within the 4 MB limit.
There are multiple strategies you can use to avoid this error:
-
Use compression with a custom payload codec for large payloads.
- This addresses the immediate issue of the blob size limit; however, if blob sizes continue to grow this problem can arise again.
-
Break larger batches of commands into smaller batch sizes:
- Workflow-level batching:
- Modify the Workflow to process Activities or Child Workflows into smaller batches.
- Iterate through each batch, waiting for completion before moving to the next.
- Workflow Task-level batching:
- Execute Activities in smaller batches within a single Workflow Task.
- Introduce brief pauses or sleeps (for example, 1ms) between batches.
- Workflow-level batching:
-
Consider offloading large payloads to an object store to reduce the risk of exceeding blob size limits:
- Pass references to the stored payloads within the Workflow instead of the actual data.
- Retrieve the payloads from the object store when needed during execution.