© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•11mo ago
mihaaai

Chain multiple Workers/DOs with RPC stub forwarding across Service Bindings

I'm trying to achieve the most of the performance I can get by the ecosystem in a situation where I need to bounce a
request
request
from an
introduction worker
introduction worker
to a deeply nested Service Binding DO in my architecture:

Until now I've been using HTTP across all services passing requests over the
fetch()
fetch()
handler:
Introduction Worker (HTTP) -> Worker A (HTTP) -> Worker B (HTTP) -> Worker C (HTTP) -> Worker D (HTTP) -> DO (HTTP)
Introduction Worker (HTTP) -> Worker A (HTTP) -> Worker B (HTTP) -> Worker C (HTTP) -> Worker D (HTTP) -> DO (HTTP)

What I'd like achieve is switching to RPC for testing performance and speed:
Introduction Worker (HTTP) -> Worker A (RPC) -> Worker B (RPC) -> Worker C (RPC) -> Worker D (RPC) -> DO (RPC)
Introduction Worker (HTTP) -> Worker A (RPC) -> Worker B (RPC) -> Worker C (RPC) -> Worker D (RPC) -> DO (RPC)


I'd also need to adopt a zero-copy strategy at step 1 (or all step if possible) and just stream it all over to
Worker D
Worker D
where it's gonna be needed for processing for the first time.
According to docs an approach of such is possible with RPC since it supports both sending the whole
Request
Request
as an argument as well as a
ReadableStream
ReadableStream
but I'm unsure to the level of depth I can achieve, examples are few and only with 2 levels, also for
ReadableStream
ReadableStream
there are no examples.

For the
ReadableStream
ReadableStream
case is not clear if we're allowed to pass to a stub function an argument of
{ reader }
{ reader }
and then at each nested level of depth, create a new couple of
TransformStream
TransformStream
to
{ write }
{ write }
to the received reader and pass the next
{ reader }
{ reader }
deeper.

Same doubts about the
Forwarding RPC stubs
Forwarding RPC stubs
strategy, how deep can I chain them?
If anyone ever got to a situation of such can you please share your experience?
(I'm aware of the 1Mb limit for RPC, let's suppose the request is less than that)
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources
Was this page helpful?

Similar Threads

Recent Announcements

Similar Threads

Workers service binding Typescript types uses Rpc.Stub<null>
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
12mo ago
Best practice for local development with multiple workers using RPC bindings?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago