سؤال

There is this in LevelUP Documentation (https://github.com/rvagg/node-levelup#multi-process-access):

LevelDB is thread-safe but is not suitable for accessing with multiple processes. You should only ever have a LevelDB database 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.

So I could not use Node Cluster (http://nodejs.org/api/cluster.html)

Is there another option to make a multi-process (or multi-thread) Node.js Application accessing a LevelDB Database?

هل كانت مفيدة؟

المحلول

I'd say level-party is what you're looking for. Of course in terms of having multiple leveldb's for each child thread i'm not sure if know the answer to that.

نصائح أخرى

I think your only viable option would be to elect a single process to own the leveldb access and do all operations and communicate with that process via the network. Or you could just do what the rest of us do and use a traditional database server that can be accessed by multiple client processes simultaneously.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top