5 ms·
Building a To-Do List with Cloudflare Workers and KV
- steveklabnik 7y agoWorkers KV went out of beta today, and this is a great tutorial on building a small application entirely at the edge, with Workers for the code, and KV for the data. I'm the new PM on KV; I'm happy to answer any questions about any of this!
- ryanworl 7y agoWhat is the backing storage for Workers KV? In the other post today discussing it going GA, the post describes the database as last write wins. How is "last" determined? Have you explored other consistency models? If all writes are directed at some origin, I think you can do better than LWW. It doesn't sound like that is what's happening as of now, but something more tunable might be useful.
- steveklabnik 7y agoWe've got a small team that's trying to do big things. So the plan is to start small, make sure that things are reliable, rock-solid, and work well, first and foremost. Then we'll grow more capabilities over time. > What is the backing storage for Workers KV? We're not talking about it because it's not something that's guaranteed, and we may change it in the future. See above :) > How is "last" determined? There's no "determining", it's just literally whichever write happens last. This is enough for many use-cases, though obviously not all of them. > Have you explored other consistency models? We'd like to offer additional options, to let people build more and more cool stuff. It's going to take time, though. Stay tuned!
- tadeusz_wojcik 7y agoI've got small app that is using KV as poor-man time series db and wonder how could I still use it without too much cost. Currently it's writing 50 times per minute every minute, but with bulk write I could write only five times instead. Given that writes aren't free in GA, I wonder how do you calculate requests, in particular are batch writes counted as single request? Do you plan exposing more worker friendly way of batch write? Do you have any plans about atomic counters (could be really useful for rate limiting, abuse control etc)? Do you plan adding list/range operations for KV?
- steveklabnik 7y agoYeah, I guess (if I got my math right) that'd be $10/month for the writes, 2.1 million per month, first million free, and you'd just go over an extra million. > are batch writes counted as single request? Batch write is more of a convenience thing than a cost saving thing; it's billed the same way as if you'd done each write individually. > Do you plan exposing more worker friendly way of batch write? Possibly, if there's demand for it. As with any platform, you build a thing, people use it, and sometimes you don't imagine the ways that they use it. > Do you have any plans about atomic counters (could be really useful for rate limiting, abuse control etc)? I agree that this is a feature that would certainly be very useful; I'd like to have it but can't make any promises, of course. > Do you plan adding list/range operations for KV? The API does have a list call: https://api.cloudflare.com/#workers-kv-namespace-list-a-namespace-s-keys https://api.cloudflare.com/#workers-kv-namespace-list-a-name... There's no convenient wrapper for it inside of the worker; this is something people want, so we'll see!
- tadeusz_wojcik 7y agoThanks! Appreciate detailed response, all makes sense. One thing I forgot and I'd also love to see is some kind of backup/restore support.
- steveklabnik 7y agoOh I messed up the pricing above, it’s not in $5 increments, it’s per call. So it will be fifty cents for that extra 100k, not $5. Oops! This is why the computers do the billing. Backup/restore would be cool! I’ll put that in the “ideas” bucket.
- mrbonner 7y agoYou feel rusty yet stepping away from Rust? :-)
- steveklabnik 7y agoHa! I am less involved, but I’m still around :)