Hi, question about in memory state: - According to the docs, DO could be evicted from memory and los
Hi, question about in memory state:
- According to the docs, DO could be evicted from memory and losing its in memory state, I would like to know how often this happens. I am trying to fit an usecase of DO with websockets for board game sessions without writing to persistent storage because: 1. it's expensive at scale, 2. the state is temporary anyways.
15 Replies
Unknown User•8mo ago
Message Not Public
Sign In & Join Server To View
I believe it is purposefully not documented as it can change at any time without warning but iirc its somewhere around like every 10 seconds or something like that
Thanks for the asnwer, so it's not really feasible to serve as a game session then
In production, when a client disconnects it shows a Canceled Error even if the WebSocket is closed properly with a
socket.close()
from the browser when the window closes. Is there a way to prevent the errors from being thrown for normal behavior? Everything works fine and no errors are thrown locally. Everything in the Worker is already in a try/catch
. Thank you!
This question I asked in this thread here but I have not received a reply so maybe others will see the question.
https://discord.com/channels/595317990191398933/773219443911819284/threads/1277864290296135711I think I have a weird issue in a local wrangler server
Using the storage API + the alarms API yields a weird result.
If I shut off wrangler dev, it wipes the alarm data, but it keeps the storage api. This is different than remote wrangler, where it will wipe both the alarm data and the storage data.
This makes development weird, because it messes up the state of my durable object after I shut it off
I'm noticing some weirdness in how durable objects duration is billed. I'm seeing that even though no requests are being made to a durable object, just having users connected to it (using
acceptWebSocket
) is causing me to be billed duration. This goes against what the documentation suggests, which is that duration is only billed whilst request handlers are running. Am I misunderstanding something here?Is there a way to query durable object chat messages? We want users to be able to search through multiple chats.
Chat Messages?
Receiving the Request to initialize the WebSocket does consume some duration, but it should be very low
Yes we're using the durable object websocket chat sample. And we want to query the storage of the user's previous chats
https://github.com/cloudflare/workers-chat-demo
GitHub
GitHub - cloudflare/workers-chat-demo
Contribute to cloudflare/workers-chat-demo development by creating an account on GitHub.
I took a screenshot of the durable object dashboard 2 hours ago vs now, and the number of requests went up by 27, and the duration went up by 4,700 GB-sec. Something doesn't add up, right? There were some disconnects & reconnects (my laptop went to sleep), but there was no continuous usage (messages) for that time.
I didn’t see this graph before. But yeah, you can see that for the whole 2 hours, each minute (other than a few blips) I was charged 23 GB-sec per minute, even though the requests graph shows there being no requests at all during that period (other than the initial connection requests). This was one of the durable objects I was testing during that period. I had another with the exact same usage graph.

Actually the other durable object showed slightly different usage. Not too sure why it’s billed cheaper.

Hmmm. This seems wrong haha. This is the “Request Wall Time” graph for the second durable object. The first durable object shows a normal number.

Ok so the first graph shows 3x more GB-sec usage, and that probably lines up with the extra websocket connections I had to the first durable object.
I'm probably gonna need to open a support ticket because this doesn't make much sense. But I also know how... not helpful support is 😦
Hey devs, we've added one more video to our series on Real-time Apps with Durable Objects🚀
Part 6: https://youtu.be/ojhe-scYVe0
Cloudflare Developers
YouTube
Making and Answering WebRTC Calls | Build a Video Call App Part 6
Welcome back to our series on building a video call app with Durable Objects! In this video, we’ll build on the frontend we set up earlier by adding functionality for making and answering WebRTC video calls. You’ll learn how to create peer-to-peer connections, handle ICE candidates, and seamlessly send and receive video streams between users. Do...