frontpage.
newsnewestaskshowjobs

Made with ♥ by @iamnishanth

Open Source @Github

Open in hackernews

Show HN: OLMDB – ACID embedded key-value store for Node.js/Bun

https://github.com/vanviegen/olmdb
1•vanviegen•3h ago
Recently I was looking for a fast on-disk key/value store for server-side JavaScript. I expected to find an overwhelming amount of choice, but https://leveljs.org/ appeared to be the only active project. As it doesn't support transactions and it doesn't scale to more than 1 JavaScript process, it's not exactly what I was hoping for.

So, I set out to create something myself: a thin NAPI layer around http://www.lmdb.tech/doc/index.html. LMDB is cool because it's very fast and allows multiple processes to do lockless read-only transactions in parallel. And it's very much proven tech.

Eventually, the thin NAPI layer grew to be a little less thin, because I want to support simultaneous read/write transactions as well. The main trade-off that LMDB makes, though, is that it allows only a single read/write transaction at a time. This is how I've solved it:

1. I've introduced application-level 'logical' transactions. A single JavaScript process can have many logical transactions running simultaneous (say one for each async request handler function).

2. Reads within a logical transaction are handled by a read-only LMDB transaction/snapshot. Logical transactions within the same process that are started shortly after one another can share a single LMDB transaction.

3. Because reads in LMDB are very fast, they're synchronous function calls. They return `ArrayBuffer` objects that point at the actual on-disk data memory mapped by LMDB: zero-copy!

4. Writes are initially stored in an in-memory buffer attached to the transaction. Subsequent reads within that transaction search the (indexed) buffer first, so that uncommitted updates can be read back within the transaction itself.

5. We also keep track of all reads being done in the transaction, and a checksum of the values that were read.

6. Commits for read-only transaction don't do anything except release some resources, and happen synchronously.

7. Commits for read/write transactions are more involved:

- A socket connection is setup to the 'commit worker' daemon. This daemon is started automatically if it isn't running yet for a particular database. It will also automatically stop when unused.

- The client hands the control over the transaction details and buffers (which are located in a shared memory segment) over to the daemon for processing.

- The daemon starts an LMDB read/write transaction, within which it can process a large number of logical transactions. This massively improves throughput, as the sync() and top-level block rewrites can be amortized over many logical transactions.

- For each logical transaction the daemon verifies that the results for all transaction reads haven't changed since they were initially performed. If they were, that indicates a race condition, which causes the library to rerun the logical transaction function.

- If the logical transaction was not raced, the updates are applied to in the LMDB read/write transaction, and then later committed together with the rest of the batch.

Phew... so that turned out a little more, uh, interesting than the thin NAPI layer I set out to do. I'm calling it OLMDB, for Optimistic LMDB!

Manage email subscriptions from a single location in Gmail

https://workspaceupdates.googleblog.com/2025/07/manage-email-subscriptions-in-gmail.html
1•pentagrama•1m ago•0 comments

Unless users take action, Android will let Gemini access third-party apps

https://arstechnica.com/security/2025/07/unless-users-take-action-android-will-let-gemini-access-third-party-apps/
2•kmod•1m ago•0 comments

Devstral Finetuned for SIMD Porting

https://simd.info/blog/simdai_a_specialist_llm_for_simd_porting/
1•momojo•2m ago•0 comments

Brainwash '72 [video]

https://archive.org/details/Brainwash72
1•petethomas•2m ago•0 comments

Replit Collaborates with Microsoft to Bring Vibe Coding to Enterprise Customers

https://replit.com/news/microsoft-partnership
1•virtuosarmo•2m ago•1 comments

The Small Data Showdown '25: Is It Time to Ditch Spark Yet?

https://milescole.dev/data-engineering/2025/06/30/Spark-v-DuckDb-v-Polars-v-Daft-Revisited.html
1•RobinL•2m ago•0 comments

The Cost of Technical Debt

https://medium.com/@bernardgranstrom/the-hidden-cost-of-technical-debt-lessons-from-mariadb-columnstores-struggle-in-the-analytics-f3ee1b5c3080
1•jgale•4m ago•0 comments

Georgia court vacates order citing AI-invented caselaw

https://www.theregister.com/2025/07/08/georgia_appeals_court_ai_caselaw/
1•speckx•5m ago•0 comments

Why Mushrooms Are Starting to Replace Everything [video]

https://www.youtube.com/watch?v=jI2LC3WTryw
1•simonebrunozzi•5m ago•0 comments

TapTrap: Animation-Driven Tapjacking on Android

https://taptrap.click/
1•throawayonthe•5m ago•0 comments

Semiconductor industry could short out as copper runs dry

https://www.theregister.com/2025/07/08/copper_supplies_climate_change/
1•rntn•6m ago•0 comments

The Timeless Way of Learning

https://secondvoice.substack.com/p/the-timeless-way-of-learning
2•bobbyjgeorge•6m ago•1 comments

"We Accept of Course That It Is Draconian: and Deliberately So"

https://www.craigmurray.org.uk/archives/2025/07/we-accept-of-course-that-it-is-draconian-and-deliberately-so/
1•k1m•8m ago•0 comments

Embrace your ignorance – How to get the most out of customer interviews

https://russellpollari.substack.com/p/embrace-your-ignorance
1•russ_poll•10m ago•0 comments

CZI Announces New Center for Pediatric CRISPR Cures

https://chanzuckerberg.com/newsroom/center-pediatric-crispr-cures-launch/
1•krgkg•11m ago•0 comments

LLM Hallucination Detection Leaderboard

https://huggingface.co/spaces/kluster-ai/LLM-Hallucination-Detection-Leaderboard
1•rymc•13m ago•0 comments

Floor Traders Want Their Seats Back

https://www.bloomberg.com/opinion/newsletters/2025-07-08/floor-traders-want-their-seats-back
1•ioblomov•16m ago•1 comments

Tech Lead Manager: it's a trap (and I'm still in it)

https://grahamgilbert.com/blog/2025/07/07/tlm-its-a-trap-and-im-still-in-it/
1•dipierro•18m ago•0 comments

Peter Jackson Tries to Resurrect a Giant Bird That Went Extinct 600 Years Ago

https://www.ign.com/articles/its-more-jurassic-park-than-lord-of-the-rings-but-peter-jackson-is-trying-to-resurrect-a-giant-bird-that-went-extinct-600-years-ago-the-celebrated-director-tells-us-why
2•HelloUsername•19m ago•0 comments

IBM Power11 Raises the Bar for Enterprise IT

https://newsroom.ibm.com/2025-07-08-ibm-power11-raises-the-bar-for-enterprise-it
1•ksec•20m ago•0 comments

Peter Jackson backs long shot de-extinction plan starring New Zealand's lost moa

https://apnews.com/article/peter-jackson-moa-de-extinction-colossal-biosciences-04260e26cbe04e787640c9502df94dda
4•petethomas•21m ago•0 comments

Synthetic Chromatophores for Color and Pattern Morphing Skins

https://advanced.onlinelibrary.wiley.com/doi/10.1002/adma.202505104
1•PaulHoule•24m ago•0 comments

Cluely filed a DMCA takedown for tweet about their system prompt

https://twitter.com/jackhcable/status/1942636823525679182
6•taytus•24m ago•0 comments

Words Don't Compile

https://blog.surkar.in/words-dont-compile
1•manthan1674•24m ago•0 comments

Facial recognition cameras could be introduced to tackle fare dodging on Tube

https://www.standard.co.uk/news/transport/facial-recognition-cameras-fare-dodging-tube-london-underground-tfl-b1237049.html
2•pseudolus•24m ago•0 comments

Dynamical origin of Theia, the last giant impactor on Earth

https://arxiv.org/abs/2507.01826
6•bikenaga•25m ago•0 comments

Judge rules that VMware must support crucial Dutch government agency migration

https://www.theregister.com/2025/06/30/dutch_agency_wins_right_to/
1•Logans_Run•27m ago•0 comments

Skia Graphite: Chrome's rasterization back end for the future

https://blog.chromium.org/2025/07/introducing-skia-graphite-chromes.html
2•ingve•27m ago•0 comments

Google's Moonshot Project Gears Up for Human Trail of AI-Designed Drugs

https://in.mashable.com/science/96798/googles-secret-moonshot-project-gears-up-for-human-trail-of-ai-designed-drugs
1•Bluestein•27m ago•0 comments

What Gets Measured, AI Will Automate

https://hbr.org/2025/06/what-gets-measured-ai-will-automate
1•Michelangelo11•27m ago•0 comments