Consistent state KV (Durable objects) and Websocket support is also here!

This enables stuff like Real-time collaborative document editing or Atomic counters

This is a dream come true :smiley:

https://blog.cloudflare.com/introducing-workers-durable-objects/

Pricing is said to be lower than AWS DynamoDB or Google Cloud Firestore.

13 Likes

This is pure awesome. Congratulations to the Workers team - you’ve just proved again that real artists ship!

2 Likes

Making these underlying primitives available at first instead of a higher-level abstraction is absolutely the right way to go. Nice work!

“Durable Objects” is such an awkward name though. Durable implies storage, which is not really the primary selling point, and if I’m understanding it, not even necessary - some of the most interesting use cases involve no use of the provided storage backend.

imo, they should be called Singletons. Cloudflare Singletons, or Worker Singletons etc.

1 Like

Agreed. I haven’t read into it, but it does look more like single-source KV than object storage.

Very exciting. Cloudflare seems to be getting itself on the leading edge of latest technology - a huge leap from a company CDN services years ago. Looking forward to see it grow and also grow along with it.

The way I see is the “instance” of the class is durable. Stored as is, until updates come in. No need to instantiate and “hydrate”, just leave it as is and comeback and continue to use its properties and functions?

Wooww That is a great Feature !

I just requested to Join the Beta Invitation.
Hope it will be fast approved.
Cant await to test and use it in production maybe even in combination with CRON for Workers as long it is really low latency as promised.

My Plan is to use this Durable Object like described in the Counter Example
as a Low Latency Inmemory Syncronisation betweeen Workers.
Very similar to Semaphores/Mutex/Events in C but for Workers(Threads)
No Storage beside InMemory actually will be needed.

// Apply requested action.
let url = new URL(request.url);
switch (url.pathname) {
  case "/increment":
    ++this.value;
    break;
  case "/decrement":
    --this.value;
    break;
  case "/":
    // Just serve the current value. No storage calls needed!
    break;
  default:
    return new Response("Not found", {status: 404});
}

// Return current value.
return new Response(this.value);

// Derive the ID for the counter object named "my-counter".
// This name is associated with exactly one instance in the
// whole world.
let id = COUNTER_NAMESPACE.idFromName("my-counter");

// Send a request to it.
let response = await COUNTER_NAMESPACE.get(id).fetch(request);

Since more than 8 Days i did not recieve any status update email from Cloudflare about my Beta Invitation.

Why do i have this functionality not yet activated ?

I really need this Functionality for my workers now.

Please unlock it as fast as possible for me !

Thanks in advance.
Romeo

You’re not allowed to use the Beta products in production, even if they enable them.
However, you can of course develop ahead of time, that’s how I use it.

I’m also waiting for a response on the beta activation, they contacted me but didn’t finish it up.

3 Likes

I request as well for proof of concept and testing.
Using beta in production is dangerous and has a high engineering cost, often specs change between Beta and GA and you are forced to refactor.

:crossed_fingers:

5 Likes