© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•7mo ago
see translation

Worker -> Durable Object fetch RPC call performance in Rust

Hello I'm running into some performance issues using Workers and Durable Objects. I'm using rust. I would like some help improving performance.

I have a worker that clients connect to. The Worker then passes the request through to a Durable Object (DO) which establishes a websocket connection and sends over a somewhat large batch of data.

I measured a measures for a cold start of the durable object.
* the total time for the Durable Object "fetch" method to complete
do_t
do_t

* total time for the worker to call the durable object fetch
worker_t
worker_t

* size of the payload the durable object sends
size
size


Then I take
Δt = worker_t - do_t
Δt = worker_t - do_t
to measure the latency for the worker to call the durable object fetch. I plot
Δt/size
Δt/size
to get the attached plot. The equation of the plotted linear regression is
y = 0.16x + 295
y = 0.16x + 295
so rate in increase in latency is
0.16 ms/KB
0.16 ms/KB
(or
50Mbs
50Mbs
) is this expected?. Also my interpretation of the
290
290
is the fixed time in
ms
ms
for my DO to boot up. Is there a way to make this faster? A
290ms
290ms
startup seems slow.

My main thoughts:
* Am I just doing something dumb to make this slow?
* How can I improve this scaling (the
0.16ms/KB
0.16ms/KB
)? Could it be caused by crossing a WASM <-> JavaScript boundary? If so, could I improve performance by rewriting this all in JavaScript.
* How can I improve the startup time?
* What are some things I should look for? I noticed I maybe be doing an extra allocation of the data, could things like that be significant.
* is there a better way to directly measure the Durable Object startup time than what I've done here?

I also attached some code snippets where I call the durable object from the worker, and the the
fetch
fetch
method:
image.png
foo.rs1.95KB
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

RPC Durable Object not working
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2y ago
Access Durable Object RPC from Worker with Vite plugin
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
2mo ago
Latency on worker and Durable object
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
17mo ago
How do i send data from worker to durable object fetch?
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago