Parallelism in Workers and Durable Objects

I assume that if 2 clients make simultaneous requests to a worker, then multiple workers will spin up to handle the requests simultaneously. But if those workers both communicate with the same instance of a Durable Object, then that object will handle the requests sequentially.

That’s my understanding of basic use cases, but I’m unclear about more complex configurations. For example, a worker calls a durable object defined in a different worker vs calling a durable object defined in the same worker. Does the DO defined in the same worker run in the same thread with the worker that called it?

Are there any guidelines around when to put a Durable Object in its own worker, vs alongside an existing worker? My mental model for Durable Objects is that they are essentially a separately hosted worker that has additional bindings for state management, so I suspect it doesn’t matter much where the Durable Object class is defined, but I’d like to confirm.

What about when using service bindings, does a worker’s request to another worker that is bound via service bindings in wrangler.toml run on the same conceptual (or literal) thread?

For context, I have a worker and durable objects that manage websocket connections, and I’m trying to understand if my calls to other workers and other durable objects (which could be time intensive) are going to block any websocket event handling.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.