3 ms·
I poked around with this a few months ago to figure out how it works locally. The answer is SQLite: https://til.simonwillison.net/deno/deno-kv https://til.simon
by simonw 3y ago
I poked around with this a few months ago to figure out how it works locally. The answer is SQLite: https://til.simonwillison.net/deno/deno-kv https://til.simonwillison.net/deno/deno-kv
I'm finding the business model aspect of Deno KV absolutely fascinating.
const kv = await Deno.openKv();
That's a Deno core API. It works fine in the open source version of Deno using a local SQLite database file.
But as soon as you deploy your application to their proprietary hosted service, that core API feature gets massively more powerful. It's no longer a SQLite database, it's now a globally distributed key/value store backed by FoundationDB, replicated around the world.
It looks like they've extended that idea further with the latest version - you can now do this:
export DENO_KV_ACCESS_TOKEN="personal access token"
const kv = await Deno.openKv(
"https://api.deno.com/databases/your-database/connect",
);
And your local code is now able to manipulate that remote FoundationDB database as well.
I'm having trouble thinking of a precedent for this - an open source project that has a core API which is effectively a lead generator for their proprietary cloud service.
I'm not entirely sure how I feel about it. I think I like it: open source projects need a business model, and the openKv() method is still a supported, useful part of the open source offering.
Kind of fascinating pattern though.
UPDATE: I just found this page of docs https://github.com/denoland/deno/blob/be1fc754a14683bf640b7bf0ecf6e286d02ee118/ext/kv/README.md https://github.com/denoland/deno/blob/be1fc754a14683bf640b7b... - which describes the "KV Connect" protocol they are using. It looks like this evens the playing field, in that anyone could implement their own alternative backend to Deno Deploy if they wanted to.
This firmly establishes me on the "I think this is cool" side of the fence.
- lobstrosity420 3y ago> I'm having trouble thinking of a precedent for this - an open source project that has a core API which is effectively a lead generator for their proprietary cloud service. Is this not Vercel’s entire business model? I don’t think they invented it either.
- lioeters 3y agoI suppose it's a variation on the "freemium" model.
- ilrwbwrkhv 3y agoThis is the enshittification of open source. It has been happening for a while with a bunch of startups like Supabase claiming to be "open source" and marketing themselves as such but making it really hard to self host for a long time. It wasn't just them either. I would see with disgust a bunch of startups use "open source" as their marketing tactic, no matter how hard it was to setup or run without their hosted service. It is also a peverse incentive: the harder the open source system is to run and maintain, the more you will gravitate toward their cloud. Supposedly open source companies raising a ton of money from VC is also strangely contrary to the open source ethos. Deno KV is basically the next jump in that chain. Richard Stallman was right once again, as usual.
- LASR 3y ago> This is the enshittification of open source. You can simply not use it, no? I am not going to make any sweeping generalizations across all products. But at least in the case of Deno KV, there doesn't seem to be lock-in. So if you were running something self-hosted for KV persistence, it will continue to work unmodified. > I would see with disgust a bunch of startups use "open source" as their marketing tactic. Again, not sure which bunch of startups. But I am not seeing that with this product. Seems more like a survival strategy to add some cashflow behind the developers. I am curious what you think Open Source should be (or should not be). I think it's fair that running a service in the cloud should cost something. And self-hosting it, I think it's fair that it requires a bit more effort than using the hosted service.
- Matl 3y agoOne does not have to use/not use something to have valid criticisms of it/opinions about it [1] 1 - https://i.kym-cdn.com/entries/icons/original/000/036/647/Screen_Shot_2021-03-01_at_2.28.39_PM.png https://i.kym-cdn.com/entries/icons/original/000/036/647/Scr...
- satvikpendem 3y agoThat meme doesn't further your point because the peasant is "using" society and understands the problems with it.
- decodr 3y agoNextJS / Vercel is not the same thing but shares similar approach
- ianbicking 3y agoI like this too... it's practical API but there's no way you can actually provide this production API for free. So instead of an open source project pulling back stuff you'd expect to be free (because it has zero marginal cost), they are adding stuff in that makes sense to be paid.
- explaininjs 3y agoCloudflare KV is basically the exact same. Even the same name. Cloudflare’s pricing seems more reasonable, though a 1:1 comparison is impossible. Cloudflare reads and writes in every region for the same price, Deno scales price with number of replica regions. Also CF is billed per read/write operation (and supports listing), this is billed per kB read/written. That all said, if your values are bigger than ~2kB Cloudflare is almost certainly cheaper. And the list (with metadata) operation is quite powerful. However, single-region means you don’t have to care about synchronization nearly as much, which can be quite annoying. The end user experience will suffer in areas far from your write zone though. A better comparison might actually be Cloudflare D1, a hosted SQL with per-kB fees, but that’s still beta.
- lucacasonato 3y agoYes, Deno KV is much closer to D1 than to Cloudflare KV.
- explaininjs 3y agoExcept D1 gives you a full powered SQL interface and DKV gives you “get”, “set”, and transactions. D1 is also faaaaaar cheaper. Like 3+ orders of magnitude cheaper.
- ramesh31 3y agoWhy does a KV store need SQLite? Does it provide transactionality?
- simonw 3y agoWhat would you use instead? By the time you've implemented even a basic key-value store with on-disk storage you've probably written a bunch of code that would be unnecessary if you had used SQLite.
- crabmusket 3y agoLMDB?
- deleted 3y ago[deleted]
- teacpde 3y agoSQLite is superb choice as a local storage solution, you don't need a transactionality requirement to use it as a KV store. People choose NoSQL databases primarily for scaling reasons, which is not the problem here.
- skybrian 3y agoI'm wondering if this might become interesting for a Sandstorm-like use case, where you can write a personal web app, publish it on GitHub, and other people can deploy it easily to their own Deno Deploy account. (Or they can self-host if they prefer.)