We measured a Durable Object alarm loop. The analytics undercounted it by ~4x
On a test DO with a 1-second alarm loop, analytics reported about a quarter of the real alarm runs and row writes, and the loop took 5 minutes to stop.
I wanted to know how fast workerfuse actually stops a Durable Object alarm loop, so I built one: a test DO with an alarm that sets the next alarm 1 second out, forever.
What turned up
- DO analytics reported about a quarter of the real alarm invocations and row writes. Not sure why yet. So if you're reading DO usage from analytics, the real number might be a lot higher.
- After the stub version was deployed, the loop kept going for about 5 minutes. A busy DO doesn't switch to the new code right away.
- Put together, for a namespace analytics already knows about: 5 minutes until the next guard run, plus 1 to 3 minutes of analytics lag, plus about 5 minutes for the DO to pick up the stub. So roughly 11 to 13 minutes. New namespaces show up as unknown for 20 to 25 minutes, so those take longer.
Point 1 is why the default limits are low ($0.25/hour, $2/day). If analytics shows a quarter of the truth, the limit needs room for that.
11 to 13 minutes isn't instant, and I don't want to pretend it is. But without an automatic stop the loop just keeps going until somebody notices.