Best practice to handle large workflow/activity payload (> blob size limit 2MB)

The blob size limit for payloads is 2MB (Temporal Platform limits sheet | Temporal Documentation) and we’re looking for a workaround for this limit. For simplicity, say our activity calls an external service which we don’t have control over size of the return data.

The workaround can be simple as this.

  • Activity calls the external service and got a resp R.
  • Marshal R into a byte slice (we’re writing workflow/activity in Go). If the slice length is < 1.5MB (or something similar), store full resp R in the activity’s return value. If not, store R in some persistent storage and keep the pointer to that in the activity’s return value.

Is there a better way to do this? Thanks!

Hi @aimee

That is the recommendation, for large payloads store the payload in an external storage and pass over the key/reference, and anything else your workflow code needs as part of your business logic.

say our activity calls an external service which we don’t have control over size of the return data.

Marshal R into a byte slice (we’re writing workflow/activity in Go). If the slice length is < 1.5MB (or something similar), store full resp R in the activity’s return value.

1.5MB is already a large payload, if you start having many of those in the same workflow execution you can soon hit 50MB and your workflow will be terminted by the server.

If you have this kind of uncertainty I would do it always, it might simplify the code you have in your activities too.

Antonio