News for hackers. Stuff that matters.
Re:Building With Workers KV, a Fast Distributed Key-Value Store by skrebbel on Friday September 28, 2018 @09:24AM (#18093088)
I love it and want to use it, but two announcements of a new cloud hosted distributed DB and no mention of how consistency works or how conflicts are handled worries me a bit.

Maybe one of the cloudflare people that read HN can shed some light on this? What happens when I write to the same key simultaneously from multiple workers and/or multiple edge nodes?

Re:Building With Workers KV, a Fast Distributed Key-Value Store by kentonv on Friday September 28, 2018 @09:51AM (#18093307)
> What happens when I write to the same key simultaneously from multiple workers and/or multiple edge nodes?

It's eventually-consistent. Eventually, one of the writes "wins".

If you do a read/modify/write in the context of processing a single request from a Worker, we'll automatically apply optimistic concurrency so that the write fails if another write has occurred on the same key concurrently.

But otherwise, yes, the ability to handle transactions is limited. For now, Workers KV can be used for a variety of use cases but is not a full replacement for a database.

Workers KV is only the first of multiple storage-related projects we're working on. Stay tuned. :)

Re:Building With Workers KV, a Fast Distributed Key-Value Store by kloepper on Friday September 28, 2018 @10:03AM (#18093418)
Hi skrebbel, storage is my project at Cloudflare.

Last write wins, for some definition of last (https://en.wikipedia.org/wiki/Eventual_consistency).

As we see how initial developers make use of the storage, we are planning to add additional synchronization and consistency functionality. For example the ETags model using If-None-Match and If-Match would be appealing to some.

Re:Building With Workers KV, a Fast Distributed Key-Value Store by aaaaaaaaaab on Friday September 28, 2018 @10:23AM (#18093583)
They write it in the description: eventual consistency with global consistency within 10 sec.
Re:Building With Workers KV, a Fast Distributed Key-Value Store by zzzcpan on Friday September 28, 2018 @10:36AM (#18093702)
That's rather vague definition. And is also wrong. They obviously can't guarantee global consistency within 10 sec, as that would require consensus which is impossible to guarantee in bounded time and they probably don't even use any consensus algorithm at all, as that would be pointless for a CDN.
Re:Building With Workers KV, a Fast Distributed Key-Value Store by kentonv on Friday September 28, 2018 @10:45AM (#18093782)
Yes, in the presences of a network partition, propagation can take arbitrarily long. But, that would be classified as an outage. Knowing the typical non-outage delay is useful.