Experimenting with an LMDB-backed Array(like) implementation #211
Replies: 2 comments 9 replies
-
When I run the lmdb-array benchmark, it seems to run with very little stress on the heap at all:
This was on node v16 and v18 (on ubuntu). What version of node are you running? I wonder if I am doing something wrong? (it does indeed OOM on the other benchmarks). |
Beta Was this translation helpful? Give feedback.
-
BTW, one other thing I was going to mention is that you can actually open an lmdb store without a path, and will do almost exactly what you are doing, create a store with a random name in the OS temp directory (and will also open it with noSync and auto-delete it on close). I know that is peripheral to the main issue of memory, but perhaps a nice convenience. |
Beta Was this translation helpful? Give feedback.
-
The idea being that LMDB can free up memory for huge arrays of data which would otherwise OOM the process (or need a really large machine).
We have some Gatsby sites that can put 10GB+ of memory in arrays.
The idea is that LMDB is fast enough that the tradeoff of lower memory for slower iteration speed won't be so bad.
This is all grand in theory — the only problem I'm having so far is my test code so far isn't freeing up memory so it OOMs a bit earlier than a normal JS array would.
My benchmark code reads in objects from an LMDB db (up to 1 million) & then pushes them onto the lmdb-backed array.
This is what the push method looks like:
I assume/hope I'm just holding onto memory somewhere inadvertently? Would appreciate some quick looks through the code.
Beta Was this translation helpful? Give feedback.
All reactions