Skip to content

docs: add go docs for payload storage#4424

Merged
lennessyy merged 18 commits intomainfrom
large-payload-go
Apr 10, 2026
Merged

docs: add go docs for payload storage#4424
lennessyy merged 18 commits intomainfrom
large-payload-go

Conversation

@lennessyy
Copy link
Copy Markdown
Contributor

@lennessyy lennessyy commented Apr 9, 2026

What does this PR do?

  • Add go docs for payload storage

Notes to reviewers

┆Attachments: EDU-6196 docs: add go docs for payload storage

@vercel
Copy link
Copy Markdown

vercel bot commented Apr 9, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
temporal-documentation Ready Ready Preview, Comment Apr 10, 2026 8:00pm

Request Review

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 9, 2026

📖 Docs PR preview links

@lennessyy lennessyy marked this pull request as ready for review April 9, 2026 20:15
@lennessyy lennessyy requested a review from a team as a code owner April 9, 2026 20:15
Copy link
Copy Markdown
Contributor

@flippedcoder flippedcoder left a comment

Choose a reason for hiding this comment

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

Just a couple of small things to consider!

layers that handle different concerns:

<CaptionedImage
src="/diagrams/data-converter-flow-with-external-storage.svg"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The arrows in and out of the container looked a little weird to me in dark mode. It could be fine, just worth another look.
Image

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

switched to themed images. i think maybe after this PR i will just update our captioned images component to have a dark/light theme

@@ -0,0 +1,315 @@
---
id: large-payload-storage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could the id be changed to external-storage to match the page title? Maybe external-storage-aws if the other cloud platforms are coming later.

```go
import (
"github.com/aws/aws-sdk-go-v2/config"
awss3 "github.com/aws/aws-sdk-go-v2/service/s3"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Any particular reason why you aliased the import to awss3 instead of just using the default and calling s3.NewFromConfig?

<!--SNIPEND-->

By default, payloads larger than 256 KiB are offloaded to external storage. You can adjust this with the
`PayloadSizeThreshold` option, even setting it to 0 to externalize all payloads regardless of size. Refer to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
`PayloadSizeThreshold` option, even setting it to 0 to externalize all payloads regardless of size. Refer to
`PayloadSizeThreshold` option, even setting it to 1 to externalize all payloads regardless of size. Refer to

The minimum value for externalizing all payloads in the Go SDK is 1. That is because the construction of the ExternalStorage struct already has this field set to 0. We interpret 0 to mean the default value.


- `Name()` returns a unique string that identifies the driver instance. The SDK stores this name in the claim check
reference so it can route retrieval requests to the correct driver. Changing the name after payloads have been stored
breaks retrieval. For example, two S3 drivers could be named `"s3-us-east"` and `"s3-eu-west"`.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure that drivers would actually be named after the region that they might be targeting. Maybe they'd be named for why they are stored differently.

reference so it can route retrieval requests to the correct driver. Changing the name after payloads have been stored
breaks retrieval. For example, two S3 drivers could be named `"s3-us-east"` and `"s3-eu-west"`.
- `Type()` returns a string that identifies the driver implementation. Unlike `Name()`, this must be the same across all
instances of the same driver type regardless of configuration. Both S3 drivers in the example above would return
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Both S3 drivers in the example above would return"aws.s3driver" as their type.

Only the example at the top of the page would return this. The sample driver you wrote just above this would return local-disk.

Copy link
Copy Markdown
Contributor Author

@lennessyy lennessyy Apr 10, 2026

Choose a reason for hiding this comment

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

was referring the example in text s3-us-east etc, but will clarify here

storeDir string
}

func NewLocalDiskStorageDriver(storeDir string) *LocalDiskStorageDriver {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Probably better to return StorageDriver instead of *LocalDiskStorageDriver.

## Configure payload size threshold

You can configure the payload size threshold that triggers external storage. By default, payloads larger than 256 KiB
are offloaded to external storage. You can adjust this with the `PayloadSizeThreshold` option, or set it to 0 to
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same comment about how 1 is the minimum for externalizing all payloads in Go.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

ahh that's right

c, err := client.Dial(client.Options{
ExternalStorage: converter.ExternalStorage{
Drivers: []converter.StorageDriver{driver},
PayloadSizeThreshold: 0,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@lennessyy lennessyy merged commit 88b97f2 into main Apr 10, 2026
10 checks passed
@lennessyy lennessyy deleted the large-payload-go branch April 10, 2026 21:06
Copy link
Copy Markdown
Contributor

@drewhoskins-temporal drewhoskins-temporal left a comment

Choose a reason for hiding this comment

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

approved but please look at my comments either here or in a followup PR.


### 4. Configure the Client

Pass an `ExternalStorage` struct with your driver in the Client options:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Call out/link out to plugins here as well.

Comment on lines +8 to +10
- Go SDK
- Temporal SDKs
- Data Converters
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

did you intentionally include fewer tags/keywords here than in the encyclopedia?

## Use multiple storage drivers

When you register multiple drivers, you must provide a `DriverSelector` that implements the `StorageDriverSelector`
interface. The SDK returns an error at client creation if multiple drivers are registered without a selector. The
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: There's no need to point out the error, especially at a moment when we're just trying to figure out what selectors do.

- Driver migration. Your Worker needs to retrieve payloads created by clients that use a different driver than the
one you prefer. Register both drivers and use the selector to always pick your preferred driver for new payloads.
The old driver remains available for retrieving existing claims.
- Latency vs. durability tradeoffs. Some Workflow types may benefit from a faster storage backend
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm having second thoughts about this. I'm not sure we should recommend a non-durable solution. In fact, it contradicts above where we recommend "In production, use a durable storage system"
There are indeed a few customers who do this, but it feels like very "at your own risk" rather than something we should recommend.

For an alternative, let's do multi-cloud. S3 if you're on AWS , GCS if on gcloud, etc.

slug: /external-storage
toc_max_heading_level: 4
keywords:
- external-storage
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I searched for "Large payloads" and this doc didn't come up. Does it need to be a tag for that to happen?
The main thing that made docs come up was the "#large-payloads" slack channel mention.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants