Skip to content

Conversation

@thomsoncf
Copy link

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 guide

Key content includes:

  • Explanation of subrequest limits and how RPC calls from dynamic workers count against them (50 for PAYG, 1,000 for Enterprise)
  • Anti-pattern documentation showing the problematic architecture (multiple RPC calls from dynamic worker to DO)
  • Recommended pattern using RpcTarget to pass storage references directly to dynamic workers running inside Durable Objects
  • Complete working code examples in TypeScript with proper wrangler configuration
  • Technical implementation details explaining:
    • Why RpcTarget vs WorkerEntrypoint
    • Environment bindings vs RPC parameters
    • Isolate lifetime considerations
    • How to pass additional capabilities like broadcast functions

Files modified:

  • Created: dynamic-workers-with-storage.mdx (sidebar order: 4)
  • Created: 2026-01-14-dynamic-workers-storage-guide.mdx (changelog)
  • Updated: best-practices/index.mdx - sidebar order 4 → 5
  • Updated: best-practices/websockets.mdx - sidebar order 5 → 6
  • Updated: best-practices/error-handling.mdx - sidebar order 6 → 7

This documentation is based on production troubleshooting and technical guidance from the Workers platform team.

@github-actions github-actions bot added product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ product:changelog size/l labels Jan 14, 2026
# Durable Object

class WebSocketHibernationServer(DurableObject):
def __init__(self, state, env):
Copy link
Contributor

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

Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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
Copy link
Contributor

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.

  1. This limit is being changed to be customer configurable by end of week.
  2. 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:
Copy link
Contributor

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

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

Labels

product:changelog product:durable-objects Durable Objects: https://developers.cloudflare.com/workers/learning/using-durable-objects/ size/l

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants