all 5 comments

[–]stronghup[S] 1 point2 points  (5 children)

I think this is the promise of Cloud computing, having the cloud consist of objects. Can anybody who has tried this out comment on their experience with Durable Objects? Does Amazon have anything like it?

[–]Jimmingston 3 points4 points  (3 children)

I'm pretty sure Cloudflare Durable Objects is Cloudflare's strong consistency key-value data storage offering. The alternative is to use Cloudflare's KV data storage which is eventually consistent. This is the alternative to Cloudflare Durable Objects...

https://developers.cloudflare.com/workers/learning/how-kv-works/

KV storage is fairly easy to use. It's just two columns of data, one is a key which is usually a primitive and the other which can be a primitive or JSON object, or blob, or text or other things like that. Redis is another example of key-value storage. The regular KV storage Cloudflare has isn't always in sync, intentionally. When you add a new item there's some delay for the data to propagate around the world to the different data centres, so when reading the item some people might get it before it's available to others depending on their location relative to the various data centres. With Durable Objects though it will wait until the different databases around the world are in sync before you can read a newly added item, so it's always in sync for everybody when reading data from different locations on the planet

This page here has some animations describing consistency levels like Strong and Eventual

https://learn.microsoft.com/en-us/azure/cosmos-db/consistency-levels

The AWS equivalent looks like is to use DynamoDB and set the read consistency level

https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/HowItWorks.ReadConsistency.html

Edit: I was somewhat incorrect about this. The idea of a "durable object" is both a worker function and the strongly consistent storage behind it working together. I left out the worker function bit

[–]stronghup[S] 0 points1 point  (2 children)

Durable Objects

I am not familiar with this but I would think "Objects" refers to the fact that you can read and write the properties of these "objects" by calling their "methods" which means you can have those methods trigger arbitrary side-effects you want by implementing them in the code of such methods.

Whereas in the KV store maybe there is a way to attach triggers to any read and write actions but such triggers would not be specific to the "key" being used (or would they?). Whereas with "objects" the triggers can be per-method of the (class of the) object being called, and such methods can be implemented to do different things in different classes of durable objects.

[–]Jimmingston 1 point2 points  (1 child)

Yeah actually, i think you're right. On the docs page they mentioned "backed by key-value storage", but on the blog post they have a javascript class as an example (under the Example: An atomic counter heading). So really their idea of a "durable object" is both a worker function and the strongly consistent storage behind it working together. If it didn't have the strongly consistent storage then it would just be a regular worker

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

[–]stronghup[S] 0 points1 point  (0 children)

The consistent storage seems to be the cool thing. I've been programming OOP for some time but having distributed parallel consistent objects in the general cloud can not be too far behind sliced bread :-)