-
Notifications
You must be signed in to change notification settings - Fork 11.6k
[Durable Objects] Add best practices guide for using Dynamic Workers with storage #27638
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
base: production
Are you sure you want to change the base?
[Durable Objects] Add best practices guide for using Dynamic Workers with storage #27638
Conversation
| # Durable Object | ||
|
|
||
| class WebSocketHibernationServer(DurableObject): | ||
| def __init__(self, state, env): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Formatting changes here seem wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are any of the changes here intentional?
| pcx_content_type: navigation | ||
| sidebar: | ||
| order: 4 | ||
| order: 5 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
| title: Error handling | ||
| pcx_content_type: concept | ||
| sidebar: | ||
| order: 6 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why?
|
|
||
| A common example is a collaborative canvas application where user-submitted code processes AI responses in chunks, storing each chunk and broadcasting changes to multiple clients in real-time. | ||
|
|
||
| ## Understanding subrequest limits |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would actually drop this entire section.
- This limit is being changed to be customer configurable by end of week.
- This is actually not the key point at all, see my latest reply on the slack chat that triggered this.
|
|
||
| ### Why this matters with dynamic workers | ||
|
|
||
| If your dynamic worker makes multiple RPC calls per operation (for example, one to save data, one to broadcast changes), and processes many operations (for example, 50+ chunks from a streaming API), you can quickly exceed subrequest limits: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah again, this is not about the subrequests limit
Adds comprehensive documentation for using Dynamic Worker Loaders with Durable Objects storage. This best practices guide addresses a common architectural challenge where developers executing untrusted user code within dynamic workers need efficient access to Durable Object storage without hitting subrequest limits.
New documentation:
/src/content/docs/durable-objects/best-practices/dynamic-workers-with-storage.mdx- Complete best practices guide with working code examples/src/content/changelog/durable-objects/2026-01-14-dynamic-workers-storage-guide.mdx- Changelog entry announcing the new guideKey content includes:
RpcTargetto pass storage references directly to dynamic workers running inside Durable ObjectsRpcTargetvsWorkerEntrypointFiles modified:
dynamic-workers-with-storage.mdx(sidebar order: 4)2026-01-14-dynamic-workers-storage-guide.mdx(changelog)best-practices/index.mdx- sidebar order 4 → 5best-practices/websockets.mdx- sidebar order 5 → 6best-practices/error-handling.mdx- sidebar order 6 → 7This documentation is based on production troubleshooting and technical guidance from the Workers platform team.