Closed twojcik closed 12 years ago
leveldb
locks the database file so multiple processes will not be able to open it. There is only support for multiple thread accesses to a database in the underlying library. There is no support for concurrent database access from multiple processes.
You could spawn a dedicated Node.js process for leveldb
and use IPC to access the database as described, but unless and until the leveldb
itself supports multiple processes, it is not currently possible to access a database from multiple processes.
Thanks @mikepb. In that case I'll find other way to do want I want:).
You could try to use ØMQ with the as_buffer
option to do what you want:
https://github.com/JustinTulloss/zeromq.node
I'm not sure how faster a Node.js core cluster would be, though.
Hi, I know that sharing the same leveldb instance between various processes is discouraged, but I was wondering if it could work in case of node.js core cluster where only master process would update database and workers would only query db. Did anyone tried that?
Cheers,