Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is SQLite fit as a backend for KV? #18657

Open
petamoriken opened this issue Apr 11, 2023 · 5 comments
Open

Is SQLite fit as a backend for KV? #18657

petamoriken opened this issue Apr 11, 2023 · 5 comments
Labels
ext/kv Related to "Deno.openKv()" API needs discussion this topic needs further discussion to determine what action to take suggestion suggestions for new features (yet to be agreed)

Comments

@petamoriken
Copy link
Contributor

The unstable key-value store is implemented in SQLite now, however there are more lightweight and better performing key-value store backends.

Why not choose a better one, like Chrome stopped using SQLite and developed LevelDB for IndexedDB?

@losfair
Copy link
Member

losfair commented Apr 11, 2023

LSM-tree backends like LevelDB or RocksDB are generally heavier than SQLite, both in binary size and runtime overhead. For example, they need to spawn a thread for merging the parts in the background.

@aapoalas aapoalas added suggestion suggestions for new features (yet to be agreed) needs discussion this topic needs further discussion to determine what action to take labels Apr 15, 2023
@Leokuma
Copy link

Leokuma commented Apr 19, 2023

There's a nice comparison here: https://www.slideshare.net/InsightTechnology/dbtstky2017-c23-sqlite

SQLite4 (now dead) tried to follow the LSM path.

Highlights:

Many people believe:

  • B-tree = slow and bad
  • LSM = fast and good

But the truth is more complicated…..

Lessons

  • SQLite3 is already very fast and hard to beat
  • LSM is great for “blind” writes, but does not work as well when constraints must be checked
    prior to each write
  • Many workloads do more reading than writing

image

@lino-levan
Copy link
Contributor

SQLite is fast. I was in a talk by Dr. Hipp regarding his continued work on SQLite and people don't fully appreciate how optimized the performance really is. If you send him an email with a slow query, he often is willing to spend some time trying to optimize SQLite for your query (happened for me a couple of times).

@alexgleason
Copy link
Contributor

Related: #18975

There's already a very good lmdb-js, which the author states has "pretty direct mappings" to Deno.KV

@bartlomieju bartlomieju added the ext/kv Related to "Deno.openKv()" API label Jul 23, 2023
@Leokuma
Copy link

Leokuma commented Jul 23, 2023

Resources:

Heed is the LMDB wrapper for Rust recommended by LMDB's author.

I'm just worried that I found lots of dead repos with stale issues related to LMDB.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ext/kv Related to "Deno.openKv()" API needs discussion this topic needs further discussion to determine what action to take suggestion suggestions for new features (yet to be agreed)
Projects
None yet
Development

No branches or pull requests

7 participants