Live data from Hacker News

Introducing Workers KV

blog.cloudflare.com

51–60 of 103 posts

Re: Introducing Workers KV

#51
post #33

Earlier quoted context omitted.

If you can find a good Javascript library for doing it you can build it into your Worker with Webpack.

It's not finding a parser that I find problematic, it's the dataset needed. My understanding is that the workers are limited to 128MB of ram and that they may be 'restarted' at any time. Datasets for accurate browser detection would be really tight in fitting into that amount of RAM when combined with whatever else you may be doing and you have to deal with load / parse time whenever a worker is restarted. This seems…

> ... understanding is that the workers are limited to 128MB of ram and that they may be 'restarted' at any time. Datasets for accurate browser detection would be really tight in fitting into that amount of RA

I think you might be overestimating that. Bundling the aforementioned https://github.com/faisalman/ua-parser-js wouldn't be significant - maybe hundreds of KB as a script (distinct from memory!) - at most.

Re: Introducing Workers KV

#52
post #44

Earlier quoted context omitted.

Rate limiting doesn't have to be coordinated to work. But you do need a PN-Counter, which they are only considering at this point.

A PN-Counter is a method of coordination. And if the writes were coordinated with the consistency time, that would be sufficient to implement consistent counters (or even a naive counter in a store given atomic operatons).

PN-Counter is coordination-free counter, it can't be used as a method of coordination. But it's ok for global rate limiting, as it doesn't have to guarantee exact rate at any point in time, as long as it eventually averages on specified rate.

Re: Introducing Workers KV

#53
Is there an API method that can list existing/matching keys in a namespace with a glob or prefix or similar?

Like, "show me all keys that match xyz∗ in this namespace"

Re: Introducing Workers KV

#54
post #53

Is there an API method that can list existing/matching keys in a namespace with a glob or prefix or similar? Like, "show me all keys that match xyz∗ in this namespace"

We're planning on adding support for range requests (which becomes equivalent to prefixes a la CouchDB). Is there a reason you need glob specifically?

Re: Introducing Workers KV

#56
post #53

Is there an API method that can list existing/matching keys in a namespace with a glob or prefix or similar? Like, "show me all keys that match xyz∗ in this namespace"

We're planning on adding support for range requests (which becomes equivalent to prefixes a la CouchDB). Is there a reason you need glob specifically?

What you're describing would work...

Re: Introducing Workers KV

#57
Great job - was trying to something similar by setting up three etcd raft nodes on each continent, but this is like 150+ nodes. Mind sharing of you’re using good clocks, paxos or raft to coordinate?

Would also be great if CF could do websocket / sse fanout at the edges - if I have a couple million websockets connected on ws.cf.com/key1 and I update the value, would be great if the new value could be broadcast. That would help with a lot of media / real-time / sports games, apps and websites.

Re: Introducing Workers KV

#58
post #9

With the shopping cart example, I'm not sure I understand how session identity can be preserved if I clear my local storage/cookies?

It's moving that shopping cart data from being stored at a single origin, to being stored in the network all around the world. The advantage of that in that use-case is you can render your site just as quickly as if it was a static website, but it can contain the customer's personal shopping cart data.

The shopping cart is still stored somewhere, but when the user has cleared their cookies, etc., what information do you have that will let you it's their shopping cart so you can find it again?

There's a (K,V) pair somewhere, but in order to get V, you need K, which you've lost.

Re: Introducing Workers KV

#59
This is very cool, but how do you limit an end user to only being able to read a given set of values. It seems to me that this scheme puts all credentials for access in the browser, and they'll be able to just run roughshod all over your data without constraints in place.

Can you create data spaces/keys for ones that are read-write per-user and others that are read-only for a given user?

Re: Introducing Workers KV

#60

Earlier quoted context omitted.

Where are you getting 1 write per second from?

1 write per second per key. It's from the Limits and Pricing section of the technical post: https://blog.cloudflare.com/building-with-workers-kv/

Thanks, that begins to answer some of my questions/concerns.
Post reply on HN