Workers KV Questions Regarding Data Consistency

I’ve read through your documentation about Workers KV and am unclear about a few things. I understand that if you do a write within a worker, it is eventually consistent. What if you write outside a of worker, using the http api endpoint? For the http api, do you guarantee global consistency when the http request completes? Does it work exactly the same for a delete operation? What about for a write to the same key (which would be an update)?

1 Like

More info here:

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.

It looks like both Write interfaces do the same thing and are both eventually consistent. The propagation is also lazy and will only be replicated to data centers that are actively reading the key, rather than going to all PoPs at once.

Global consistency is generally obtained in around a second, but we guarantee it (outside of exceptional network partition situations) in ten seconds. That is true whether you are writing from a central location or out at the edge.

KV is generally designed for situations where you are writing relatively infrequently, and then readying very very frequently from your Workers.