Building With Workers KV, a Fast Distributed Key-Value Store
blog.cloudflare.com
blog.cloudflare.com
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?
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. :)
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.
I wonder how this kind of speed is achieved with an API that has to go over the network? Even if the round trip is short such as between two AWS services, there's always at least some latency.
It's likely that this KV store is built on top of the existing cache storage layer, which would also explain the eventual consistency and high-reads with low-writes.
Listing keys in a namespace and/or TTLs would be nice with KV.
Didn't we discuss just last week an article[0] by CloudFlare where they said they'd solved this problem and Tor users wouldn't need to solve CAPTCHAs for CloudFlare-fronted services anymore?
What happened to that? I've actually seen way more CloudFlare CAPTCHAs through Tor since that article came out.