louischatriot / nedb

The JavaScript Database, for Node.js, nw.js, electron and the browser

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

pm2 cluster and nedb

tamis-laan opened this issue · comments

commented

I'm building an application using nedb to keep track of registered users. I'm using pm2 to keep the website running. However when I'm using pm2 in cluster mode which basically allows node to use multiple cores nedb starts to exhibits faulty behavior. I guess this is because the database is in memory and is not shared between the cores. Is there some way around this, or some alternative I could use?

It's an embedded database. You should probably switch to a dedicated database like mongo that can handle queries from many different processes. Since nedb's API is a subset of mongo's that shouldn't be too difficult to switch over to.

commented

Yes I figured that out too, moved to Redis, should have closed this issue. Thanks for the help though!