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

Multi-process access to DB #13

Open
dappelt opened this issue Nov 28, 2017 · 1 comment
Open

Multi-process access to DB #13

dappelt opened this issue Nov 28, 2017 · 1 comment

Comments

@dappelt
Copy link
Collaborator

dappelt commented Nov 28, 2017

Claim writer and channel watcher run in separate processes but access the same db. Did you find a solution for accessing the db from multiple processes? From the levelup docs:

Stores like LevelDB are thread-safe but they are not suitable for accessing with multiple processes. You should only ever have a store open from a single Node.js process. Node.js clusters are made up of multiple processes so a levelup instance cannot be shared between them either.
See the aformentioned wiki for modules like multilevel, that may help if you require a single store to be shared across processes.

Did you check multilevel?

@emschwartz
Copy link
Owner

I didn't find a good solution yet. Right now the XRP plugin is using lowdb, which just writes to a JSON file on disk. I was in the middle of trying to switch it over to using a levelup-compliant store but haven't yet.

Multilevel seems like a good option but is unfortunately out of date and not compatible with the latest levelup version.

I was also looking into whether using RocksDB (Facebook's fork of leveldb) would be an option, because it allows for multiple readers. The Node.js module unfortunately doesn't expose the read-only option right now but it should be possible to add that (see Level/rocksdb#13 (comment))).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants