Well, I guess the read in-memory caching would probably still exist, but can you now use get without
Well, I guess the read in-memory caching would probably still exist, but can you now use get without await?
const ran = await runDurableObjectAlarm(stub); expect(ran).toBe(true);// expects true but is falsethis.state.getWebSockets on each stub, is this 1 DO request per stub? Do these count toward the subrequest limit of the initially invoked Worker?
Will the DO billing charge for cold-starts etc ?No, you pay only the time after your DO is running.
IF, Workers consumes 10ms (and hence billing time = 10ms) for above simple Use-case, is it "FAIRLY ACCURATE" to assume that the DO will also consume 10ms (and hence billing time = 10ms) for the same Use-case.Assuming that the
10ms is actual round trip time for your operation, then yes, DOs should have similar performance as Workers. It's the same runtime so code behavior is identical.@cloudflare/next-on-pages with DO's?durable-utils@0.3.0: https://github.com/lambrospetrou/durable-utils#readmeStaticShardedDO abstraction extended with more methods one/some/all() and tryOne/trySome/tryAll(). There are a couple other utilities added for retries like tryN(...).StaticShardedDO class and let me know what you think or what's not convenient.Conclusion : Workers Compute is 12.5x times COSTLIER than DO-Compute.That's a very unusual conclusion for real world applications. Anyone can do their calculations of course, but please be careful when you compare them otherwise you will be in for not so nice surprises.
walltime is the max of it anyway in the worst case.Q#1 : What is "billable compute" time for Worker ?This is NOT correct. Since your worker was just waiting for the DO here it doesn't count as CPU time and shouldn't be billed.
A#1 : (My Understanding) : Time_END - Time_START - 10ms
Could not serialize object of type "DurableObject" it("adds jobs and schedules an alarm", async () => {
const result = await runInDurableObject(stub, async (instance, state) => {
return await instance.addJobs([
{ url: "https://example.com" },
{ url: "https://example.org" },
]);
});
expect(result).toBe("Jobs added");
// Run the alarm (which calls processQueue & processTimeouts)
const ran = await runDurableObjectAlarm(stub);
expect(ran).toBe(true);
const status = await runInDurableObject(stub, async (instance) => {
return await instance.getStatus();
});
expect(status).toEqual([{ status: "pending", count: 2 }]);
});Durable Object alarms are not reset between test runs and do not respect isolated storage. Ensure you delete or run all alarms with runDurableObjectAlarm() scheduled in each test before finishing the test. afterEach(async () => {
// Clear any pending alarms between tests.
await runInDurableObject(stub, async (_instance, state) => {
await state.storage.deleteAlarm();
});
vi.restoreAllMocks();
});Could not serialize object of type "DurableObject"