I’ve been toying with Durable Objects locally over the past day, and just set up a live worker that uses them to implement some basic multiplayer in a little JS game I’m working on.
Just to be safe, I figured I’d set up a usage notification since the 400,000 GB-s is probably pretty easy to hit with my current setup with about a thousand games a month. But not even an hour after setting it up, I got an email that said I just crossed 400,000 “requests”. Which is super incorrect - see attached image for what usage said when I got the email. Also included the notification setup, and the resulting email.
Did I set up the notification wrong? Does 400,000 here not mean 400,000 GB-s (is it some other unit)?
My biggest worry is that somehow my local dev playing with these persisted or something… I was constantly shutting down wrangler dev, so that seems unlikely - still, this has me slightly worried that there’s some invisible number racking up quickly.
The durable object is essentially a room that two people connect to via websockets, where they update one another each second via a websocket message. When one person leaves, the other’s socket is closed too, so it should be shutting down rapidly. Any ideas where this 400,000 came from, and what it might mean?
As an experiment, I set the notification up again, but this time for 1 million “request duration”.
So I played another game with a friend using this worker - because I suspect something with the numbers isn’t as it seems. After that, the total the durable object said it used over the past 24 hours was 572 GB-s, with a total of 42 requests. The worker itself has about 148 requests. But then, not long after, I got this email:
I suspect that the number here doesn’t actually mean GB-s. But I’m not sure what it could actually be, since it doesn’t really correlate with the GB-s expenditure in a way I can puzzle out.
These notification units have been vague before, I’m not really sure about this one lol. There are a lot of possibilities, one would expect it to be GB-s since it is what you get billed on, but I’m guessing its some smaller unit of time, maybe equal to what they track it in their end, but I don’t remember with what exact precision they use.
This is really unclear, and doesn’t seem to be in any documentation
That does seem way more likely! I feel that it’s most likely B-s, since my present amount of recorded consumption adds up to just under 600,000 B-s. With the local testing I did before I published the worker, that easily could have added up to at least 1,000,000 B-s.
Thanks for the thoughts! I do wish the unit were specified, but this definitely puts my mind at ease.