Closed paralin closed 9 years ago
Hi there @kidovate -- multi-core support is on the list of things we want for v0.6.0 :smile:
In the meantime, you can try running NodeBB with pm2
? That'll auto-scale it up to 8 processes for you (with the proper flags, that is... by default, it starts 1 proc)
Hi,
I've not used it, can you give me an example?
Thanks!
On Tue, Aug 12, 2014 at 9:31 AM, Julian Lam notifications@github.com wrote:
In the meantime, you can try running NodeBB with pm2? That'll auto-scale it up to 8 processes for you (with the proper flags, that is... by default, it starts 1 proc)
Reply to this email directly or view it on GitHub https://github.com/NodeBB/NodeBB/issues/1983#issuecomment-51939808.
I believe it is: pm2 start app.js -i max
Keep in mind, this starts the NodeBB APPLICATION as many times as there are cores. Don't do this on loader.js
, that's the process that kickstarts the application, and where we'd probably build our own tool to start additional processes.
currently using pm2
(8 processes on an 8 core server) works but only for non socket calls. Chat messages don't appear and the connection shows to constantly be lost and re established (from the browser) very rapidly.
Any help on this?
Check out this branch https://github.com/NodeBB/NodeBB/tree/cluster
The constant reconnection was fixed with using a RedisStore here
Although some of the realtime functionality is still not working 100% this is because of the function we use to get connected clients namely io.sockets.clients()
. This only returns sockets that are connected to that particular worker. And since some of the features in nodebb rely on this to return all connected clients they don't work if the users are sending socket requests to different workers.
We will have to refactor those parts to not use io.sockets.clients(). It might be a good idea to update to socket.io 1.0.6 as well.
For Mongo installs, I'm assuming there's a MongoStore you can use with socket.io?
Milestone of the cluster branch is now set to 0.5.1. Not merged into that branch yet.
At present refactoring the loader in order to attain feature parity.
Hi,
Currently on my 8 core server NodeBB is just using one, this is highly inefficient, is there any way to setup NodeBB to use multiple cores using the
cluster
package perhaps?Thanks